/*
ont-space - The ontology-based resource metadata repository
Copyright (c) 2006-2008, Information Eng. Research Unit - Univ. of Alcalï¿½
http://www.cc.uah.es/ie
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package org.ontspace.lom.owl;

import com.hp.hpl.jena.rdf.model.NodeIterator;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
import org.ontspace.owl.*;
import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.ontology.ObjectProperty;
import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.Ontology;
import com.hp.hpl.jena.ontology.Ontology.*;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.net.URISyntaxException;
import java.net.URI;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.ieee.ltsc.lom.LOM;
import org.ieee.ltsc.lom.LOMUtil;
import org.ontspace.MetadataRecordReference;
import org.ontspace.lom.LOMQueryManager;
import org.ontspace.util.translator.lom2owl.LOM2OWLTranslator;
import org.ontspace.util.translator.lom2owl.owl.LOM2OWLTranslatorImpl;

/**
 * Implementation for a LOM query manager
 *
 */
public class LOMQueryManagerImpl extends QueryManagerImpl
        implements LOMQueryManager {

    private MetadataRepositoryImpl _rep;
    private List<Ontology> _onts =
            new ArrayList<Ontology>();
    private List<URI> _uriList;
    private String _nsName =
            "http://www.cc.uah.es/ie/ont/lom2owl";
    private OntModel _OntModel =
            null;

    /**
     * Creates a new instance of LOMQueryManagerImpl
     * @param rep Repository
     * @param params Parameters HashMap for the specific configuration
     * @throws java.lang.ClassNotFoundException
     * @throws java.lang.NoSuchMethodException
     */
    public LOMQueryManagerImpl(MetadataRepositoryImpl rep, HashMap params)
            throws ClassNotFoundException, NoSuchMethodException {

        super(rep);
        _rep =
                rep;
        this._uriList =
                new ArrayList<URI>();
        addRequiredOntologies(params);
    }

    /**
     * Adds the required ontology to the ontologies list
     * @param ont Ontology to be added into the list
     */
    @Override
    public void addOntologyRef(Ontology ont) {
        if (ont != null) {
            _onts.add(ont);
        }
    }

    /**
     * Adds the required ontologies URI to the object
     * @param params
     */
    private void addRequiredOntologies(HashMap params) {
        String ontologyUri;
        int i =
                1;
        boolean finished =
                false;
        while (!finished) {
            String paramName =
                    "uri" + i++;
            ontologyUri =
                    (String) params.get(paramName);
            if (ontologyUri != null) {
                try {
                    this._uriList.add(new URI(ontologyUri));
                } catch (URISyntaxException ex) {
                    Logger.getLogger(QueryManagerImpl.class.getName()).
                            log(Level.SEVERE, null, ex);
                }
            } else {
                finished =
                        true;
            }
        }
    }

    /**
     * Gets a list with the URIs of the ontologies required by the query manager
     * @return A list whith the USIs of the required ontologies
     */
    @Override
    public List<URI> getRequiredOntologies() {
        return this._uriList;
    }

    /**
     * Gets the ontology model asociated to queryManager
     * @return tne ontologyModel
     */
    @Override
    public OntModel getOntologyModel() {
        OntModel ontmodel =
                null;
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                ontmodel =
                        ont.getOntModel();

            }
        }
        return ontmodel;
    }

    /**
     * Close repository
     */
    public void close() {

        this._rep.close();
        this._rep =
                null;
    }

    /**
     * Gets a LOM object, inserts its information in a created instance, and 
     * stores that instance in the repository.
     * @param lo the learning object to store
     * @param confFile the configuratio file with repository options
     * @return the learning object reference of the stored learning object. 
     *
     */
    public MetadataRecordReference storeNewLearningObject(LOM lo,
            String confFile) throws
            Exception {
        // Create new LO:
        Individual newLO =
                createNewLOInstance();
        // Add the general category to the LO
        addLOMMetadata(newLO, lo, _rep, confFile);

        MetadataRecordReference newLORef =
                new MetadataRecordReferenceImpl(
                _rep.getRepositoryURI(), newLO.getURI());

        return newLORef;
    }

    /**
     * Creates a new Learning Object instance. 
     * @return the learning object individual instance
     */
    protected Individual createNewLOInstance() {

        if (_OntModel == null) {
            this._OntModel =
                    this.getOntologyModel();
        }
        // Load the learningObject concept and the ontology:

        OntClass loClass =
                _OntModel.getOntClass(_nsName + "#learningObject");


        MetadataRecordReference newRef =
                MetadataRecordReferenceFactory.
                    createLearningObjectReference(_rep.getRepositoryURI());


        Individual loInd =
                _OntModel.createIndividual(_nsName + "#lo-" +
                newRef.getLocalMetadataRecordId(),
                loClass);
        return loInd;

    }

    /**
     * Inserts lom object information into an instance, and stores that instance 
     * in the repository selected.
     * @param lo the learning object individual instance
     * @param lom the learning object
     * @param _rep Repository
     * @param configFilePath the path to config xml file
     * 
     */
    protected void addLOMMetadata(Individual lo, LOM lom,
            MetadataRepositoryImpl _rep,
            String configFilePath)
            throws Exception {


        FileWriter errorFile =
                new FileWriter("error.log");

        BufferedWriter bw =
                new BufferedWriter(errorFile);
        PrintWriter errorWriter =
                new PrintWriter(bw);
        errorWriter.println("WARNINGS");
        errorWriter.println("");

        LOM2OWLTranslator t =
                new LOM2OWLTranslatorImpl(lo, lom, _rep, _OntModel,
                configFilePath, errorWriter);

        t.translate();

    }

    /**
     *  Get the LOM that satisfy the comparation modes
     * @param lom learning object
     * @param comparationModes specifies the search criteria
     * @return the search results
     */
    public LOMQueryResultImpl queryLO(LOM lom, List comparationModes) {

        if (_OntModel == null) {
            this._OntModel =
                    this.getOntologyModel();
        }

        LOMQueryResultImpl resultedFinalSet =
                new LOMQueryResultImpl();

        Set<MetadataRecordReference> resultedSet =
                new HashSet<MetadataRecordReference>();

        Set<MetadataRecordReference> resultedSetAux =
                new HashSet<MetadataRecordReference>();


        resultedSet.clear();
        resultedSetAux.clear();

        // GENERAL ---------------------------------------------------------

        // (1.1) General - Identifier

        if ((LOMUtil.getCatalog(LOMUtil.getGeneralIdentifier(lom, 0)) != null)) {
            try {

                System.out.println("1.1. GENERAL IDENTIFIER -----------------" +
                        "-------------------------------------------");

                String catalogLOMGI =
                        String.valueOf(LOMUtil.getCatalog(LOMUtil.getGeneralIdentifier(lom,
                        0)));
                String entryLOMGI =
                        String.valueOf(LOMUtil.getEntry(LOMUtil.getGeneralIdentifier(lom,
                        0)));

                /* Set that will contain the MetadataRecordReference that
                represents an element that have as identifier, the same that
                the indicated in  the lom object. */

                Set<MetadataRecordReference> set1_1 =
                        new HashSet<MetadataRecordReference>();
                set1_1 =
                        queryLOByIdentifier(catalogLOMGI, entryLOMGI);

                if (resultedSetAux.size() == 0) {
                    resultedSetAux.addAll(set1_1);
                }
                resultedSet.clear();
            } catch (Exception ex) {
                Logger.getLogger(LOMQueryManagerImpl.class.getName()).log(Level.SEVERE,
                        null, ex);
            }

        }

        // (1.2) General - Title 

        String titleGT =
                String.valueOf(LOMUtil.getString(LOMUtil.getGeneralTitle(lom), 0));
        String languageGT =
                String.valueOf(LOMUtil.getLanguage(LOMUtil.getGeneralTitle(lom),
                0));

        if ((!titleGT.equals("null") || (!languageGT.equals("null")))) {

            System.out.println("1.2. GENERAL TITLE ----------------------" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as title, the same that the 
            indicated in the lom object. */
            Set<MetadataRecordReference> Set1_2 =
                    new HashSet<MetadataRecordReference>();


            Set1_2 =
                    queryLOByLangString(titleGT, languageGT, "hasTitle");

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set1_2);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set1_2.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (1.3) General - Language

        String languageLOM =
                LOMUtil.getString(LOMUtil.getGeneralLanguage(lom, 0));

        if (languageLOM != null) {

            System.out.println("1.3. GENERAL LANGUAGE ----------------------" +
                    "--------------------------------------");

            Set<MetadataRecordReference> Set1_3 =
                    new HashSet<MetadataRecordReference>();

            Set1_3 =
                    queryLOByHumanLanguage(languageLOM);

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set1_3);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {

                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set1_3.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (1.4) General - Description 

        String elementLOMGD =
                String.valueOf(LOMUtil.getString(LOMUtil.getGeneralDescription(lom,
                0), 0));
        String languageLOMGD =
                String.valueOf(LOMUtil.getLanguage(LOMUtil.getGeneralDescription(lom,
                0), 0));

        if ((!elementLOMGD.equals("null") ||
                (!languageLOMGD.equals("null")))) {

            System.out.println("1.4. GENERAL DESCRIPTION ----------------" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as description, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set1_4 =
                    new HashSet<MetadataRecordReference>();

            Set1_4 =
                    queryLOByLangString(elementLOMGD, languageLOMGD,
                    "hasDescription");

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set1_4);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {

                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set1_4.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (1.5) General - Keyword

        String elementLOMGK =
                String.valueOf(LOMUtil.getString(LOMUtil.getGeneralKeyword(lom,
                0), 0));
        String languageLOMGK =
                String.valueOf(LOMUtil.getLanguage(LOMUtil.getGeneralKeyword(lom,
                0), 0));

        if ((!elementLOMGK.equals("null") ||
                (!languageLOMGK.equals("null")))) {

            System.out.println("1.5. GENERAL KEYWORD --------------------" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element  that have as keywords, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set1_5 =
                    new HashSet<MetadataRecordReference>();
            Set1_5 =
                    queryLOByLangString(elementLOMGK, languageLOMGK,
                    "hasKeyword");

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set1_5);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set1_5.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (1.6) General - Coverage 

        if ((LOMUtil.getGeneralCoverage(lom, 0) != null) &&
                (LOMUtil.getGeneralCoverage(lom, 0) != null) &&
                (!(String.valueOf(LOMUtil.getString(LOMUtil.getGeneralCoverage(lom,
                0), 0))).equals("")) &&
                (!(String.valueOf(LOMUtil.getLanguage(LOMUtil.getGeneralCoverage(lom,
                0), 0))).equals(""))) {

            System.out.println("1.6. GENERAL COVERAGE -------------------" +
                    "-------------------------------------");

            String elementLOMGC =
                    String.valueOf(LOMUtil.getString(LOMUtil.getGeneralCoverage(lom,
                    0), 0));
            String languageLOMGC =
                    String.valueOf(LOMUtil.getLanguage(LOMUtil.getGeneralCoverage(lom,
                    0), 0));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as coverage, the same that the 
            indicated in the lom object. */
            Set<MetadataRecordReference> Set1_6 =
                    new HashSet<MetadataRecordReference>();

            Set1_6 =
                    queryLOByLangString(elementLOMGC, languageLOMGC,
                    "hasCoverage");
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set1_6);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set1_6.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (1.7) General - Structure

        if ((LOMUtil.getGeneralStructure(lom) != null) && 
                (!(String.valueOf(LOMUtil.getSource(LOMUtil.getGeneralStructure(lom))).
                equals(""))) && (!(String.valueOf(LOMUtil.getValue(LOMUtil.getGeneralStructure(lom))).
                equals("")))) {

            System.out.println("1.7. GENERAL STRUCTURE ------------------" +
                    "--------------------------------");

            String itemSourceGS =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getGeneralStructure(lom)));
            String itemValueGS =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getGeneralStructure(lom)));
            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as structure, the same that the
            indicated in the lom object. */
            Set<MetadataRecordReference> Set1_7 =
                    new HashSet<MetadataRecordReference>();

            Set1_7 =
                    queryLOByVocabularyItemString(itemValueGS, "hasStructure");



            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set1_7);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set1_7.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }


                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (1.8) General - Aggregation Level

        if ((LOMUtil.getGeneralAggregationLevel(lom) != null) &&
                (LOMUtil.getGeneralAggregationLevel(lom) != null) && 
                (!(String.valueOf(LOMUtil.getSource(LOMUtil.getGeneralAggregationLevel(lom))).
                equals(""))) && (!(String.valueOf(LOMUtil.getValue(LOMUtil.getGeneralAggregationLevel(lom))).
                equals("")))) {

            System.out.println("1.8. GENERAL AGGREGATION LEVEL ----------" +
                    "----------------------------------------");

            String itemSourceGAL =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getGeneralAggregationLevel(lom)));
            String itemValueGAL =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getGeneralAggregationLevel(lom)));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as aggregation level, the same 
            that the indicated in the lom object. */
            Set<MetadataRecordReference> Set1_8 =
                    new HashSet<MetadataRecordReference>();

            String aLcM =
                    comparationModes.get(1).toString();
            Set1_8 =
                    queryLOByVocabularyItemNumber(
                    itemValueGAL, "hasAggregationLevel", aLcM);

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set1_8);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set1_8.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // -----------------------------------------------------------------

        // LIFE CYCLE ------------------------------------------------------
        // (2.1) LifeCycle - Version

        if ((LOMUtil.getLifeCycleVersion(lom) != null) &&
                (!(String.valueOf(LOMUtil.getString(LOMUtil.getLifeCycleVersion(lom),
                0))).equals("")) &&
                (!(String.valueOf(LOMUtil.getLanguage(LOMUtil.getLifeCycleVersion(lom),
                0))).equals(""))) {

            System.out.println("2.1. LIFECYCLE VERSION ------------------" +
                    "----------------------------------------");

            String elementLOMLCV =
                    String.valueOf(LOMUtil.getString(LOMUtil.getLifeCycleVersion(lom),
                    0));
            String languageLOMLCV =
                    String.valueOf(LOMUtil.getLanguage(LOMUtil.getLifeCycleVersion(lom),
                    0));



            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as version the same that the 
            indicated in the lom object. */
            Set<MetadataRecordReference> Set2_1 =
                    new HashSet<MetadataRecordReference>();
            Set2_1 =
                    queryLOByLangString(elementLOMLCV, languageLOMLCV,
                    "hasVersion");
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set2_1);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set2_1.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (2.2) LifeCycle - Status

        if ((LOMUtil.getLifeCycleStatus(lom) != null) &&
                (String.valueOf(LOMUtil.getValue(LOMUtil.getLifeCycleStatus(lom))) !=
                null)) {

            System.out.println("2.2. LIFE CYCLE STATUS  -----------------" +
                    "---------------------------------");
            String itemValueLCS =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getLifeCycleStatus(lom)));



            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as status, the same that the 
            indicated in the lom object. */
            Set<MetadataRecordReference> Set2_2 =
                    new HashSet<MetadataRecordReference>();
            String aLcM =
                    comparationModes.get(1).toString();
            Set2_2 =
                    queryLOByVocabularyItemString(
                    itemValueLCS, "hasStatus");

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set2_2);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set2_2.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (2.3) LifeCycle - Contribute

        // -----------------------------------------------------------------

        // METAMETADATA ----------------------------------------------------

        // (3) MetaMetadata

        // -----------------------------------------------------------------            

        // TECHNICAL -------------------------------------------------------

        // (4.1) Technical - Format

        // (4.2) Technical - Size  

        if (LOMUtil.getTechnicalSize(lom) != null) {
            System.out.println("4.2. TECHNICAL SIZE ---------------------" +
                    "-----------------------------");
            String sizeS =
                    LOMUtil.getString(LOMUtil.getTechnicalSize(lom));



            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as size, the same that the 
            indicated in the lom object. */
            Set<MetadataRecordReference> Set4_2 =
                    new HashSet<MetadataRecordReference>();

            Set4_2 =
                    queryDirect(sizeS, "hasSize");
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set4_2);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set4_2.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (4.3) Technical - Location 

        if (LOMUtil.getTechnicalLocation(lom, 0) != null) {

            System.out.println("4.3. TECHNICAL LOCATION -----------------" +
                    "---------------------------------");
            String locationS =
                    LOMUtil.getString(LOMUtil.getTechnicalLocation(lom, 0));


            /* Set that will contain the MetadataRecordReference that 
            represents an element  that have as location, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set4_3 =
                    new HashSet<MetadataRecordReference>();
            Set4_3 =
                    queryDirect(locationS, "isLocated");
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set4_3);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set4_3.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (4.4) Technical - Requirement

        // (4.5) Technical - Installation Remarks

        if ((LOMUtil.getTechnicalInstallationRemarks(lom) != null) &&
                (!(String.valueOf(LOMUtil.getString(LOMUtil.getTechnicalInstallationRemarks(lom),
                0))).equals("")) &&
                (!(String.valueOf(LOMUtil.getLanguage(LOMUtil.getTechnicalInstallationRemarks(lom),
                0))).equals(""))) {

            System.out.println("4.5. TECHNICAL INSTALLATION REMARKS -----" +
                    "-------------------------------------------------");

            String elementLOMTIR =
                    String.valueOf(LOMUtil.getString(LOMUtil.getTechnicalInstallationRemarks(lom),
                    0));
            String languageLOMTIR =
                    String.valueOf(LOMUtil.getLanguage(LOMUtil.getTechnicalInstallationRemarks(lom),
                    0));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as installation remarks, the 
            same that the indicated in the lom object. */
            Set<MetadataRecordReference> Set4_5 =
                    new HashSet<MetadataRecordReference>();
            Set4_5 =
                    queryLOByLangString(elementLOMTIR, languageLOMTIR,
                    "hasInstallationRemark");
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set4_5);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set4_5.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (4.6) Technical - Other Platform Requirements

        if ((LOMUtil.getTechnicalOtherPlatformRequirements(lom) != null) &&
                (!(String.valueOf(LOMUtil.getString(LOMUtil.getTechnicalOtherPlatformRequirements(lom),
                0))).equals("")) &&
                (!(String.valueOf(LOMUtil.getLanguage(LOMUtil.getTechnicalOtherPlatformRequirements(lom),
                0))).equals(""))) {

            System.out.println("4.6. TECHNICAL OTHER PLATFORM " +
                    "REQUIREMENTS ---------------------------------------" +
                    "---------------");

            String elementLOMTOPR =
                    String.valueOf(LOMUtil.getString(LOMUtil.getTechnicalInstallationRemarks(lom),
                    0));
            String languageLOMTOPR =
                    String.valueOf(LOMUtil.getLanguage(LOMUtil.getTechnicalInstallationRemarks(lom),
                    0));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as other platform requirements, 
            the same that the indicated in the lom object. */
            Set<MetadataRecordReference> Set4_6 =
                    new HashSet<MetadataRecordReference>();

            Set4_6 =
                    queryLOByLangString(elementLOMTOPR, languageLOMTOPR,
                    "hasOtherPlatformRequirement");
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set4_6);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set4_6.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (4.7) Technical - Duration

        if ((LOMUtil.getTechnicalDuration(lom) != null) && 
                (!(String.valueOf(LOMUtil.getString(LOMUtil.getTechnicalDuration(lom).
                description(), 0))).equals("")) && 
                (!(String.valueOf(LOMUtil.getLanguage(LOMUtil.getTechnicalDuration(lom).
                description(), 0))).equals("")) && 
                (!(String.valueOf(LOMUtil.getDuration(LOMUtil.getTechnicalDuration(lom).
                value()))).equals(""))) {

            System.out.println("4.7. TECHNICAL DURATION -------------------" +
                    "-------------------------------------");

            String elementLOMTD =
                    String.valueOf(LOMUtil.getString(LOMUtil.getTechnicalDuration(lom).
                    description(), 0));
            String languageLOMTD =
                    String.valueOf(LOMUtil.getLanguage(LOMUtil.getTechnicalDuration(lom).
                    description(), 0));
            String dur =
                    String.valueOf(LOMUtil.getDuration(LOMUtil.getTechnicalDuration(lom).
                    value()));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as coverage, the same that the 
            indicated in the lom object. */
            Set<MetadataRecordReference> Set4_7 =
                    new HashSet<MetadataRecordReference>();

            Set4_7 =
                    queryLOByDuration(dur);
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set4_7);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set4_7.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // -----------------------------------------------------------------                 
        // (5.1) Educational - Interactivity Type

        if ((LOMUtil.getEducationalInteractivityType(lom, 0) != null) &&
                ((String.valueOf(LOMUtil.getValue(LOMUtil.getEducationalInteractivityType(lom,
                0)))) != null)) {

            System.out.println("5.1. INTERACTIVITY TYPE -----------------" +
                    "---------------------------------");

            String itemSourceEIT =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalInteractivityType(lom,
                    0)));
            String itemValueEIT =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getEducationalInteractivityType(lom,
                    0)));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as interactivity type, the same
            that the indicated in the lom object. */
            Set<MetadataRecordReference> Set5_1 =
                    new HashSet<MetadataRecordReference>();

            Set5_1 =
                    queryLOByVocabularyItemA(itemValueEIT,
                    "hasInteractivityType", comparationModes.get(4).toString());
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set5_1);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set5_1.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (5.2) Educational - Learning Resource Type

        if ((LOMUtil.getEducationalLearningResourceType(lom, 0, 0) != null) && 
                (!(String.valueOf(LOMUtil.getSource(LOMUtil.
                getEducationalLearningResourceType(lom, 0, 0))).
                equals(""))) && (!(String.valueOf(LOMUtil.getValue
                (LOMUtil.getEducationalLearningResourceType(lom, 0, 0))).
                equals("")))) {

            System.out.println("5.2. LEARNING RESOURCE TYPE -------------" +
                    "-------------------------------------");

            String itemSourceEIL =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalLearningResourceType(lom,
                    0, 0)));
            String itemValueEIL =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getEducationalLearningResourceType(lom,
                    0, 0)));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as learning resource type, 
            the same that the indicated in the lom object. */
            Set<MetadataRecordReference> Set5_2 =
                    new HashSet<MetadataRecordReference>();

            Set5_2 =
                    queryLOByVocabularyItemString(
                    itemValueEIL, "hasInteractivityLevel");
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set5_2);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set5_2.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (5.3) Educational - Interactivity Level

        if ((LOMUtil.getEducationalInteractivityLevel(lom, 0) != null) &&
                (LOMUtil.getEducationalInteractivityLevel(lom, 0) != null) && 
                (!(String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalInteractivityLevel(lom, 0))).
                equals(""))) && (!(String.valueOf(LOMUtil.getValue
                (LOMUtil.getEducationalInteractivityLevel(lom, 0))).
                equals("")))) {

            System.out.println("5.3. INTERACTIVITY LEVEL ----------------" +
                    "----------------------------------");

            String itemSourceEIL =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalInteractivityLevel(lom,
                    0)));
            String itemValueEIL =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getEducationalInteractivityLevel(lom,
                    0)));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as interactivity level, the 
            same that the indicated in the lom object. */
            Set<MetadataRecordReference> Set5_3 =
                    new HashSet<MetadataRecordReference>();

            Set5_3 =
                    queryLOByVocabularyItemA(itemValueEIL,
                    "hasInteractivityLevel", comparationModes.get(5).toString());
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set5_3);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set5_3.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (5.4) Educational - Semantic Density

        if ((LOMUtil.getEducationalSemanticDensity(lom, 0) != null) &&
                (!(String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalSemanticDensity(lom, 0))).
                equals(""))) && (!(String.valueOf(LOMUtil.getValue
                (LOMUtil.getEducationalSemanticDensity(lom, 0))).
                equals("")))) {

            System.out.println("5.4. SEMANTIC DENSITY -------------------" +
                    "-------------------------------");

            String itemSourceESD =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalSemanticDensity(lom,
                    0)));
            String itemValueESD =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getEducationalSemanticDensity(lom,
                    0)));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as semantic density, the same 
            that the indicated in the lom object. */
            Set<MetadataRecordReference> Set5_4 =
                    new HashSet<MetadataRecordReference>();

            Set5_4 =
                    queryLOByVocabularyItemA(itemValueESD,
                    "hasSemanticDensity", comparationModes.get(2).toString());
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set5_4);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set5_4.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (5.5) Educational - Intended End User Role

        if ((LOMUtil.getEducationalIntendedEndUserRole(lom, 0, 0) != null) && 
                (!(String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalIntendedEndUserRole(lom, 0, 0))).
                equals(""))) && (!(String.valueOf(LOMUtil.getValue
                (LOMUtil.getEducationalIntendedEndUserRole(lom, 0, 0))).
                equals("")))) {

            System.out.println("5.5. INTENDED END USER ROLE -------------" +
                    "-------------------------------------");

            String itemSourceEIEUR =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalIntendedEndUserRole(lom,
                    0, 0)));
            String itemValueEIEUR =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getEducationalIntendedEndUserRole(lom,
                    0, 0)));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as intended end user role, the 
            same that the indicated in the lom object. */
            Set<MetadataRecordReference> Set5_5 =
                    new HashSet<MetadataRecordReference>();

            Set5_5 =
                    queryLOByVocabularyItemString(
                    itemValueEIEUR, "isIntendedForUserRole");

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set5_5);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set5_5.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iter.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (5.7) Educational - Typical Age Range

        if ((LOMUtil.getEducationalTypicalAgeRange(lom, 0, 0) != null) &&
                (LOMUtil.getEducationalTypicalAgeRange(lom, 0, 0) != null)) {

            System.out.println("5.7 TYPICAL AGE RANGE -------------------" +
                    "-------------------------------");

            String elementLOMETAR =
                    String.valueOf(LOMUtil.getString(LOMUtil.getEducationalTypicalAgeRange(lom,
                    0, 0), 0));
            String languageLOMETAR =
                    String.valueOf(LOMUtil.getLanguage(LOMUtil.getEducationalTypicalAgeRange(lom,
                    0, 0), 0));



            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as typical age range, the same 
            that the indicated in the lom object. */
            Set<MetadataRecordReference> Set5_7 =
                    new HashSet<MetadataRecordReference>();

            Set5_7 =
                    queryLOByLangStringRange(elementLOMETAR,
                    languageLOMETAR, "hasEducationalInformation", null, null, "");

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set5_7);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set5_7.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // (5.8) Educational - Difficulty

        if ((LOMUtil.getEducationalDifficulty(lom, 0) != null) &&
                (LOMUtil.getEducationalDifficulty(lom, 0) != null) && 
                (!(String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalDifficulty(lom, 0))).
                equals(""))) && (!(String.valueOf(LOMUtil.getValue
                (LOMUtil.getEducationalDifficulty(lom, 0))).
                equals("")))) {

            System.out.println("5.8 DIFFICULTY --------------------------" +
                    "-------------------------------------");

            String itemSourceED =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getEducationalDifficulty(lom,
                    0)));
            String itemValueED =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getEducationalDifficulty(lom,
                    0)));

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as difficult, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set5_8 =
                    new HashSet<MetadataRecordReference>();

            Set5_8 =
                    queryLOByDifficulty(itemSourceED, itemValueED,
                    "hasDifficulty", comparationModes.get(3).toString(), null,
                    null);
            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set5_8);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set5_8.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // RIGTHS ------------------------------------------------------
        // (6.1) Rigths - Cost

        if ((LOMUtil.getRightsCost(lom) != null) && (!(String.valueOf
                (LOMUtil.getSource(LOMUtil.getRightsCost(lom))).
                equals(""))) && (!(String.valueOf(LOMUtil.getValue
                (LOMUtil.getRightsCost(lom))).
                equals("")))) {

            System.out.println("6.1. RIGTHS COST ------------------" +
                    "--------------------------------");

            String itemSourceRC =
                    String.valueOf(LOMUtil.getSource(LOMUtil.getRightsCost(lom)));
            String itemValueRC =
                    String.valueOf(LOMUtil.getValue(LOMUtil.getRightsCost(lom)));
            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as structure, the same that the
            indicated in the lom object. */
            Set<MetadataRecordReference> Set6_1 =
                    new HashSet<MetadataRecordReference>();

            Set6_1 =
                    queryLOByVocabularyItemString(
                    itemValueRC, "hasCost");

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set6_1);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set6_1.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }


                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }


        //9.CLASSIFICATION


//         LOMImpl.Classification classification = lom.newClassification(0);
//                  
//          //9.1 purpose
        String purposeLOM =
                LOMUtil.getValue(LOMUtil.getClassificationPurpose(lom, 0));

        if ((LOMUtil.getClassificationPurpose(lom, 0)) != null) {

            System.out.println("9.1. CLASSIFICATION PURPOSE--------------" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as description, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set9_1 =
                    new HashSet<MetadataRecordReference>();

            Set9_1 =
                    queryLOByClassificationPurpose(purposeLOM);

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set9_1);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {

                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set9_1.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }
//                        
//        //9.2 taxon path----


//        //9.2.1 source----
//         if ((LOMUtil.getClassificationTaxonPathSource(lom,0, 0)!= null) && (!(String.valueOf(
//         LOMUtil.getString(LOMUtil.getClassificationTaxonPathSource(lom,0, 0), 0)).
//                equals(""))) && (!(String.valueOf(LOMUtil.getClassificationTaxonPathSource(lom,0, 0)).
//                equals(""))))
//         {   
//             
        String elementLOMsourceD =
                LOMUtil.getString(LOMUtil.getClassificationTaxonPathSource(lom,
                0, 0), 0);
        String languageLOMsourceD =
                LOMUtil.getLanguage(LOMUtil.getClassificationTaxonPathSource(lom,
                0, 0), 0);


        if ((LOMUtil.getClassificationTaxonPathSource(lom, 0, 0)) != null) {

            System.out.println("9.2.1. CLASSIFICATION TAXON PATH SOURCE ----------------" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as description, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set9_2_1 =
                    new HashSet<MetadataRecordReference>();

            Set9_2_1 =
                    queryLOByClassificationTaxonPathsource(elementLOMsourceD,
                    languageLOMsourceD);

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set9_2_1);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {

                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set9_2_1.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }


//         //9.2.2 TAXON

        //9.2.2.1 CLASSIFICATION TAXON PATH-TAXON ID

        String taxonIdLOM =
                LOMUtil.getString(LOMUtil.getClassificationTaxonPathTaxonId(lom,
                0, 0, 0));


        if (LOMUtil.getClassificationTaxonPathTaxonId(lom, 0, 0, 0) != null) {

            System.out.println("9.2.2.1. CLASSIFICATION TAXON PATH-TAXON ID" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as description, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set9_2_2_1 =
                    new HashSet<MetadataRecordReference>();

            Set9_2_2_1 =
                    queryLOByClassificationTaxonId(taxonIdLOM);

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set9_2_2_1);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {

                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set9_2_2_1.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }
//       
//         //9.2.2.2CLASSIFICATION TAXON ENTRY

        String entryTC =
                "";
        entryTC =
                LOMUtil.getString(LOMUtil.getClassificationTaxonPathTaxonEntry(lom,
                0, 0, 0), 0);
        String languageEntryTC =
                LOMUtil.getLanguage(LOMUtil.getClassificationTaxonPathTaxonEntry(lom,
                0, 0, 0), 0);
        if (LOMUtil.getClassificationTaxonPathTaxonEntry(lom, 0, 0, 0) != null) {

            System.out.println("9.2.2.2 CLASSIFICATION TAXON ENTRY ----------------" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as description, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set9_2_2_2 =
                    new HashSet<MetadataRecordReference>();

            Set9_2_2_2 =
                    queryLOByClasificationTaxonEntry(entryTC, languageEntryTC);

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set9_2_2_2);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {

                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set9_2_2_2.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

//        
//         //9.3.CLASSIFICATION DESCRIPTION

        String elementLOMCD =
                String.valueOf(LOMUtil.getString(LOMUtil.getClassificationDescription(lom,
                0), 0));
        String languageLOMCD =
                String.valueOf(LOMUtil.getLanguage(LOMUtil.getClassificationDescription(lom,
                0), 0));

        if ((!elementLOMCD.equals("null") ||
                (!languageLOMCD.equals("null")))) {

            System.out.println("9.3. CLASSIFICATION DESCRIPTION ----------------" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element that have as description, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set9_3 =
                    new HashSet<MetadataRecordReference>();

            Set9_3 =
                    queryLOByClassificationDescription(elementLOMCD,
                    languageLOMCD);

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set9_3);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {

                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set9_3.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }

        // 9.4 CLASSIFICATION KEYWORD

        String elementLOMCK =
                String.valueOf(LOMUtil.getString(LOMUtil.getClassificationKeyword(lom,
                0,
                0), 0));
        String languageLOMCK =
                String.valueOf(LOMUtil.getLanguage(LOMUtil.getClassificationKeyword(lom,
                0,
                0), 0));

        if ((!elementLOMCK.equals("null") ||
                (!languageLOMCK.equals("null")))) {

            System.out.println("9.4 CLASSIFICATION KEYWORD --------------------" +
                    "--------------------------------------");

            /* Set that will contain the MetadataRecordReference that 
            represents an element  that have as keywords, the same that 
            the indicated in the lom object. */
            Set<MetadataRecordReference> Set9_4 =
                    new HashSet<MetadataRecordReference>();
            Set9_4 =
                    queryLOByClassificationKeyword(elementLOMCK, languageLOMCK);

            if (resultedSetAux.size() == 0) {
                resultedSetAux.addAll(Set9_4);
            } else {
                for (Iterator iter =
                        resultedSetAux.iterator(); iter.hasNext();) {
                    MetadataRecordReference e =
                            (MetadataRecordReference) iter.next();
                    String id =
                            e.getLocalMetadataRecordId();
                    String access =
                            e.getMRRAccessInterface().toString();

                    for (Iterator iterAux =
                            Set9_4.iterator(); iterAux.hasNext();) {
                        MetadataRecordReference eAux =
                                (MetadataRecordReference) iterAux.next();
                        String idAux =
                                eAux.getLocalMetadataRecordId();
                        String accessAux =
                                eAux.getMRRAccessInterface().
                                toString();

                        if ((id.compareTo(idAux) == 0) &&
                                (access.compareTo(accessAux) == 0)) {
                            resultedSet.add(e);
                        }

                    }
                }
                resultedSetAux.clear();
                resultedSetAux.addAll(resultedSet);
            }
            resultedSet.clear();
        }





        //resultados 
        if (resultedSet.size() == 0) {
            resultedSet =
                    resultedSetAux;
        }



        for (Iterator iter =
                resultedSet.iterator(); iter.hasNext();) {
            MetadataRecordReference e =
                    (MetadataRecordReference) iter.next();
            resultedFinalSet.getMetadataRecordReference().add(e);
        //resultedFinalSet.setMetadataRecordReference(resultedSetFinal); 
        }

        return resultedFinalSet;

    }

    /**
     * This method obtains a Set of metadata record references that have as item
     * value the indicated by the parameters. 
     *
     * @param item The String that contains the item value
     * @param elementType The String that indicates the type of the element 
     * to query. 
     */
    private Set<MetadataRecordReference> queryDirect(String item,
            String elementType) {

        Boolean equal =
                false;
        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();

        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();

        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();

            //get properties
            Property element =
                    _OntModel.getProperty(_nsName + "#" + elementType);



            RDFNode elem =
                    loInstance.getPropertyValue(element);

            String instance =
                    elem.toString();
            int car2 =
                    instance.indexOf("^");
            String idinstance =
                    instance.substring(1, car2 - 1);
            if (idinstance.compareTo(item) == 0) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }

        }

        return instancesR;


    }

    private Set<MetadataRecordReference> queryLOByClasificationTaxonEntry(String entry,
            String language) {
        Boolean valueB =
                false;
        Boolean languageB =
                false;


        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();



        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasClasification =
                    _OntModel.getObjectProperty(_nsName + "#hasClassification");
            NodeIterator clasInstances =
                    loInstance.listPropertyValues(hasClasification);

            while (clasInstances.hasNext()) {

                Resource clasResource =
                        (Resource) clasInstances.next();
                ObjectProperty claKey =
                        _OntModel.getObjectProperty(_nsName +
                        "#classificationTaxonPath");
                StmtIterator ctpInstances =
                        clasResource.listProperties(claKey);
                while (ctpInstances.hasNext()) {
                    Statement ctpInstance =
                            ctpInstances.nextStatement();
                    Resource cptResource =
                            ctpInstance.getResource();
                    Property claTaxP =
                            _OntModel.getProperty(_nsName +
                            "#classificationTaxon");
                    StmtIterator claTaxProperties =
                            cptResource.listProperties(claTaxP);
                    while (claTaxProperties.hasNext()) {
                        //taxon entry
                        Statement claTax =
                                claTaxProperties.nextStatement();
                        Resource claTaxResource =
                                claTax.getResource();
                        ObjectProperty taxEntry =
                                _OntModel.getObjectProperty(_nsName +
                                "#taxonEntry");
                        StmtIterator lsInstances =
                                claTaxResource.listProperties(taxEntry);
                        while (lsInstances.hasNext()) {

                            Statement lsSt =
                                    lsInstances.nextStatement();
                            Resource lsResource =
                                    lsSt.getResource();

                            //includesSingleLangString
                            Property inSLS =
                                    _OntModel.getProperty(_nsName +
                                    "#includesSingleLangString");
                            StmtIterator slsProperties =
                                    lsResource.listProperties(inSLS);

                            //for each instance
                            while (slsProperties.hasNext()) {

                                Statement sls =
                                        slsProperties.nextStatement();
                                Resource ls =
                                        sls.getResource();

                                //instace of langStringSingle 
                                Individual slsIndividual =
                                        _OntModel.getIndividual(_nsName + "#" +
                                        ls.getLocalName());

                                //hasValue
                                Property hasValue =
                                        _OntModel.getProperty(_nsName +
                                        "#hasValue");

                                RDFNode slsValues =
                                        slsIndividual.getPropertyValue(hasValue);
                                String value =
                                        slsValues.toString();
                                int car =
                                        value.indexOf("^");
                                String hasVal =
                                        value.substring(0, car);
                                if (hasVal.compareTo(entry) == 0) {
                                    valueB =
                                            true;
                                }
                                //inLanguage
                                Property inLanguage =
                                        _OntModel.getProperty(_nsName +
                                        "#inLanguage");

                                RDFNode slsLang =
                                        slsIndividual.getPropertyValue(inLanguage);
                                String lang =
                                        slsLang.toString();
                                int car2 =
                                        lang.indexOf("^");
                                String inLang =
                                        lang.substring(0, car2);

                                if (inLang.compareTo(language) == 0) {
                                    languageB =
                                            true;
                                }
                            }

                        }
                    }
                }
            }



            if ((languageB) && (valueB)) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }
            languageB =
                    false;
            valueB =
                    false;
        }


        return instancesR;
    }

    private Set<MetadataRecordReference> queryLOByClassificationDescription(String description,
            String language) {
        Boolean valueB =
                false;
        Boolean languageB =
                false;


        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();



        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasClasification =
                    _OntModel.getObjectProperty(_nsName + "#hasClassification");
            NodeIterator clasInstances =
                    loInstance.listPropertyValues(hasClasification);

            while (clasInstances.hasNext()) {

                Resource clasResource =
                        (Resource) clasInstances.next();
                ObjectProperty claKey =
                        _OntModel.getObjectProperty(_nsName +
                        "#taxonDescription");
                StmtIterator lsInstances =
                        clasResource.listProperties(claKey);
                while (lsInstances.hasNext()) {

                    Statement lsSt =
                            lsInstances.nextStatement();
                    Resource lsResource =
                            lsSt.getResource();

                    //includesSingleLangString
                    Property inSLS =
                            _OntModel.getProperty(_nsName +
                            "#includesSingleLangString");
                    StmtIterator slsProperties =
                            lsResource.listProperties(inSLS);

                    //for each instance
                    while (slsProperties.hasNext()) {

                        Statement sls =
                                slsProperties.nextStatement();
                        Resource ls =
                                sls.getResource();

                        //instace of langStringSingle 
                        Individual slsIndividual =
                                _OntModel.getIndividual(_nsName + "#" +
                                ls.getLocalName());

                        //hasValue
                        Property hasValue =
                                _OntModel.getProperty(_nsName + "#hasValue");

                        RDFNode slsValues =
                                slsIndividual.getPropertyValue(hasValue);
                        String value =
                                slsValues.toString();
                        int car =
                                value.indexOf("^");
                        String hasVal =
                                value.substring(0, car);
                        System.out.println(hasVal);
                        if (hasVal.compareTo(description) == 0) {
                            valueB =
                                    true;
                        }
                        //inLanguage
                        Property inLanguage =
                                _OntModel.getProperty(_nsName + "#inLanguage");

                        RDFNode slsLang =
                                slsIndividual.getPropertyValue(inLanguage);
                        String lang =
                                slsLang.toString();
                        int car2 =
                                lang.indexOf("^");
                        String inLang =
                                lang.substring(0, car2);

                        if (inLang.compareTo(language) == 0) {
                            languageB =
                                    true;
                        }
                    }


                }

            }

            if ((languageB) && (valueB)) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }
            languageB =
                    false;
            valueB =
                    false;
        }


        return instancesR;
    }

    private Set<MetadataRecordReference> queryLOByClassificationKeyword(String keyword,
            String language) {
        Boolean valueB =
                false;
        Boolean languageB =
                false;


        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();



        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasClasification =
                    _OntModel.getObjectProperty(_nsName + "#hasClassification");
            NodeIterator clasInstances =
                    loInstance.listPropertyValues(hasClasification);
            while (clasInstances.hasNext()) {
                Resource clasResource =
                        (Resource) clasInstances.next();
                ObjectProperty claKey =
                        _OntModel.getObjectProperty(_nsName +
                        "#classificationKeyword");
                StmtIterator lsInstances =
                        clasResource.listProperties(claKey);
                while (lsInstances.hasNext()) {
                    Statement lsSt =
                            lsInstances.nextStatement();
                    Resource lsResource =
                            lsSt.getResource();

                    //includesSingleLangString
                    Property inSLS =
                            _OntModel.getProperty(_nsName +
                            "#includesSingleLangString");
                    StmtIterator slsProperties =
                            lsResource.listProperties(inSLS);

                    //for each instance
                    while (slsProperties.hasNext()) {
                        Statement sls =
                                slsProperties.nextStatement();
                        Resource ls =
                                sls.getResource();

                        //instace of langStringSingle 
                        Individual slsIndividual =
                                _OntModel.getIndividual(_nsName + "#" +
                                ls.getLocalName());

                        //hasValue
                        Property hasValue =
                                _OntModel.getProperty(_nsName + "#hasValue");

                        RDFNode slsValues =
                                slsIndividual.getPropertyValue(hasValue);
                        String value =
                                slsValues.toString();
                        int car =
                                value.indexOf("^");
                        String hasVal =
                                value.substring(0, car);

                        if (hasVal.compareTo(keyword) == 0) {
                            valueB =
                                    true;
                        }
                        //inLanguage
                        Property inLanguage =
                                _OntModel.getProperty(_nsName + "#inLanguage");

                        RDFNode slsLang =
                                slsIndividual.getPropertyValue(inLanguage);
                        String lang =
                                slsLang.toString();
                        int car2 =
                                lang.indexOf("^");
                        String inLang =
                                lang.substring(0, car2);

                        if (inLang.compareTo(language) == 0) {
                            languageB =
                                    true;
                        }
                    }


                }

            }

            if ((languageB) && (valueB)) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }
            languageB =
                    false;
            valueB =
                    false;
        }


        return instancesR;
    }

    private Set<MetadataRecordReference> queryLOByClassificationPurpose(String purposeLOM) {
        Boolean valueB =
                false;

        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();

        //for each instance
        while (loInstances.hasNext()) {

            Individual loInstance =
                    (Individual) loInstances.next();

            Property hasElement =
                    _OntModel.getProperty(_nsName + "#hasClassification");
            StmtIterator lsInstances =
                    loInstance.listProperties(hasElement);
            //for each element
            while (lsInstances.hasNext()) {
                Statement lsResource =
                        lsInstances.nextStatement();
                Resource res =
                        lsResource.getResource();
                Property claKey =
                        _OntModel.getProperty(_nsName + "#classificationPurpose");
                StmtIterator ctpInstances =
                        res.listProperties(claKey);
                while (ctpInstances.hasNext()) {
                    Statement ctpInstance =
                            ctpInstances.nextStatement();
                    String val =
                            ctpInstance.getString();

                    if (val.compareTo(purposeLOM) == 0) {
                        valueB =
                                true;
                    }

                }
            }

            if (valueB) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }

            valueB =
                    false;
        }

        return instancesR;
    }

    private Set<MetadataRecordReference> queryLOByClassificationTaxonId(String taxonIdLOM) {


        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();



        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasClasification =
                    _OntModel.getObjectProperty(_nsName + "#hasClassification");
            NodeIterator clasInstances =
                    loInstance.listPropertyValues(hasClasification);

            while (clasInstances.hasNext()) {

                Resource clasResource =
                        (Resource) clasInstances.next();
                ObjectProperty claKey =
                        _OntModel.getObjectProperty(_nsName +
                        "#classificationTaxonPath");
                StmtIterator ctpInstances =
                        clasResource.listProperties(claKey);
                while (ctpInstances.hasNext()) {
                    Statement ctpInstance =
                            ctpInstances.nextStatement();
                    Resource cptResource =
                            ctpInstance.getResource();
                    Property claTaxP =
                            _OntModel.getProperty(_nsName +
                            "#classificationTaxon");
                    StmtIterator claTaxProperties =
                            cptResource.listProperties(claTaxP);
                    while (claTaxProperties.hasNext()) {
                        //taxon entry
                        Statement claTax =
                                claTaxProperties.nextStatement();
                        Resource claTaxResource =
                                claTax.getResource();
                        Property taxEntry =
                                _OntModel.getProperty(_nsName + "#taxonId");
                        StmtIterator lsInstances =
                                claTaxResource.listProperties(taxEntry);

                        //instace of langStringSingle 
                        Individual slsIndividual =
                                _OntModel.getIndividual(_nsName + "#" +
                                claTaxResource.getLocalName());

                        RDFNode slsValues =
                                slsIndividual.getPropertyValue(taxEntry);
                        String value =
                                slsValues.toString();
                        int car =
                                value.indexOf("^");
                        String hasVal =
                                value.substring(0, car);
                        if (hasVal.compareTo(taxonIdLOM) == 0) {
                            MetadataRecordReference lor =
                                    new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                                    loInstance.getLocalName());
                            if (!(instancesR.contains(lor))) {
                                instancesR.add(lor);
                            }
                        }





                    }
                }



            }
        }


        return instancesR;
    }

    private Set<MetadataRecordReference> queryLOByClassificationTaxonPathsource(String elementLOMsourceD,
            String languageLOMsourceD) {

        Boolean languageB =
                false;
        Boolean valueB =
                false;

        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();



        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasClasification =
                    _OntModel.getObjectProperty(_nsName + "#hasClassification");
            NodeIterator clasInstances =
                    loInstance.listPropertyValues(hasClasification);

            while (clasInstances.hasNext()) {

                Resource clasResource =
                        (Resource) clasInstances.next();
                ObjectProperty claKey =
                        _OntModel.getObjectProperty(_nsName +
                        "#classificationTaxonPath");
                StmtIterator ctpInstances =
                        clasResource.listProperties(claKey);

                while (ctpInstances.hasNext()) {
                    Statement ctpInstance =
                            ctpInstances.nextStatement();
                    Resource cptResource =
                            ctpInstance.getResource();
                    ObjectProperty claTaxP =
                            _OntModel.getObjectProperty(_nsName +
                            "#classificationSource");
                    StmtIterator lsInstances =
                            cptResource.listProperties(claTaxP);


                    while (lsInstances.hasNext()) {

                        Statement lsSt =
                                lsInstances.nextStatement();
                        Resource lsResource =
                                lsSt.getResource();

                        //includesSingleLangString
                        Property inSLS =
                                _OntModel.getProperty(_nsName +
                                "#includesSingleLangString");
                        StmtIterator slsProperties =
                                lsResource.listProperties(inSLS);

                        //for each instance
                        while (slsProperties.hasNext()) {

                            Statement sls =
                                    slsProperties.nextStatement();
                            Resource ls =
                                    sls.getResource();

                            //instace of langStringSingle 
                            Individual slsIndividual =
                                    _OntModel.getIndividual(_nsName + "#" +
                                    ls.getLocalName());

                            //hasValue
                            Property hasValue =
                                    _OntModel.getProperty(_nsName + "#hasValue");

                            RDFNode slsValues =
                                    slsIndividual.getPropertyValue(hasValue);
                            String value =
                                    slsValues.toString();
                            int car =
                                    value.indexOf("^");
                            String hasVal =
                                    value.substring(0, car);
                            System.out.println(hasVal);
                            if (hasVal.compareTo(elementLOMsourceD) == 0) {
                                valueB =
                                        true;
                            }
                            //inLanguage
                            Property inLanguage =
                                    _OntModel.getProperty(_nsName +
                                    "#inLanguage");

                            RDFNode slsLang =
                                    slsIndividual.getPropertyValue(inLanguage);
                            String lang =
                                    slsLang.toString();
                            int car2 =
                                    lang.indexOf("^");
                            String inLang =
                                    lang.substring(0, car2);

                            if (inLang.compareTo(languageLOMsourceD) == 0) {
                                languageB =
                                        true;
                            }
                        }

                    }
                }

            }

            if ((languageB) && (valueB)) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }
            languageB =
                    false;
            valueB =
                    false;
        }


        return instancesR;
    }

    /**
     * This method obtains a Set of metadata record references that have as 
     * source and value the indicated by the parameters. This method is 
     * specific for difficulty item. 
     *
     * @param itemSource The String that contains the source 
     * @param itemValue The String that contains the value
     * @param nsName The String that contains the nameSpace of the ontology 
     * queried
     * @param elementType The String that indicates the type of the element 
     * to query. 
     */
    private Set<MetadataRecordReference> queryLOByDifficulty(String itemSource,
            String itemValue, String elementType, String comparisonModeS,
            String ns, Ontology newont) {
        Boolean languageB =
                false;
        Boolean valueB =
                false;
        int comparisonMode =
                0;
        int itemValueN =
                0;
        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        if (comparisonModeS.equals("Exactly")) {
            comparisonMode =
                    1;
        } else if (comparisonModeS.equals("Less than")) {
            comparisonMode =
                    2;
        } else if (comparisonModeS.equals("Greater than")) {
            comparisonMode =
                    3;
        } else if (comparisonModeS.equals("Less than or equals")) {
            comparisonMode =
                    4;
        } else if (comparisonModeS.equals("Greater than or equals")) {
            comparisonMode =
                    5;
        } else if (comparisonModeS.equals("noCM")) {
            comparisonMode =
                    -1;
        }


        if (itemValue.equals("very easy")) {
            itemValueN =
                    0;
        } else if (itemValue.equals("easy")) {
            itemValueN =
                    1;
        } else if (itemValue.equals("medium")) {
            itemValueN =
                    2;
        } else if (itemValue.equals("difficult")) {
            itemValueN =
                    3;
        } else if (itemValue.equals("very difficult")) {
            itemValueN =
                    4;
        }



        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();



        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasElement =
                    _OntModel.getObjectProperty(_nsName + "#" +
                    "hasEducationalInformation");
            NodeIterator lsInstances =
                    loInstance.listPropertyValues(hasElement);
            //for each element
            while (lsInstances.hasNext()) {
                Resource ls =
                        (Resource) lsInstances.next();

                Property inIS =
                        _OntModel.getProperty(_nsName + "#hasDifficulty");
                StmtIterator isProperties =
                        ls.listProperties(inIS);
                Statement st =
                        isProperties.nextStatement();
                String instIV =
                        st.getString();

                int instIVN =
                        0;
                if (instIV.equals("very easy")) {
                    instIVN =
                            0;
                } else if (instIV.equals("easy")) {
                    instIVN =
                            1;
                } else if (instIV.equals("medium")) {
                    instIVN =
                            2;
                } else if (instIV.equals("difficult")) {
                    instIVN =
                            3;
                } else if (instIV.equals("very difficult")) {
                    instIVN =
                            4;
                }

                switch (comparisonMode) {

                    // Exactly
                    case (1): {
                        if (instIVN == itemValueN) {
                            valueB =
                                    true;
                            System.out.println("EXACTLY-> " + instIVN + "==" +
                                    itemValueN);
                        }
                        break;
                    }
                    // Less than
                    case (2): {
                        if (instIVN < itemValueN) {
                            valueB =
                                    true;
                            System.out.println("LESS-> " + instIVN + "<" +
                                    itemValueN);
                        }
                        break;
                    }
                    // Greater than
                    case (3): {
                        if (instIVN > itemValueN) {
                            valueB =
                                    true;
                            System.out.println("GREATER-> " + instIVN + ">" +
                                    itemValueN);
                        }
                        break;
                    }
                    // Less than or equals
                    case (4): {
                        if (instIVN <= itemValueN) {
                            valueB =
                                    true;
                            System.out.println("LESS OR-> " + instIVN + "<=" +
                                    itemValueN);
                        }
                        break;
                    }
                    // Greater than or equals
                    case (5): {
                        if (instIVN >= itemValueN) {
                            valueB =
                                    true;
                            System.out.println("GREATER OR-> " + instIVN + ">=" +
                                    itemValueN);
                        }
                        break;
                    }
                    }
            }


            if ((valueB)) {
                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }

            valueB =
                    false;
        }
        return instancesR;
    }

    /**
     * This method obtains a Set of metadata record references that match with the
     * input value for the attribute duration. This method is 
     * specific for duration item.
     * 
     * @param duration contains the duration value     
     * @return a Set of metadata record references that match with the
     * input value for the attribute duration.     
     */
    private Set<MetadataRecordReference> queryLOByDuration(String duration) {

        Boolean valueB =
                false;


        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();



        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();


        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasDuration =
                    _OntModel.getObjectProperty(_nsName + "#hasDuration");
            NodeIterator dInstances =
                    loInstance.listPropertyValues(hasDuration);
            while (dInstances.hasNext()) {
                Resource loId =
                        (Resource) dInstances.next();


                //Comprobacion de value
                Property des =
                        _OntModel.getProperty(_nsName + "#hasDurationValue");
                StmtIterator desProperties =
                        loId.listProperties(des);
                while (desProperties.hasNext()) {
                    Statement desS =
                            desProperties.nextStatement();
                    String desValue =
                            desS.getString();

                    if (desValue.compareTo(duration) == 0) {
                        valueB =
                                true;
                    }
                }

                if ((valueB)) {
                    MetadataRecordReference lor =
                            new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                            loInstance.getLocalName());
                    if (!(instancesR.contains(lor))) {
                        instancesR.add(lor);
                    }
                }

                valueB =
                        false;
            }
        }

        return instancesR;
    }

    /**
     * This method obtains a Set of metadata record references that match with the
     * input value for the attribute language. This method is 
     * specific for language item.
     * 
     * @param languageLOM contains the language value
     * @return a Set of metadata record references that match with the
     * input value for the attribute language
     */
    private Set<MetadataRecordReference> queryLOByHumanLanguage(String languageLOM) {
        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();

        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();

            //hasLanguage
            Property hasLanguage =
                    _OntModel.getProperty(_nsName + "#hasLanguage");


            RDFNode slsLang =
                    loInstance.getPropertyValue(hasLanguage);
            String lang =
                    slsLang.toString();
            int car2 =
                    lang.indexOf("^");
            String inLang =
                    lang.substring(0, car2);

            if (inLang.compareTo(languageLOM) == 0) {
                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }

        }

        return instancesR;
    }

    /**
     * This method obtains a Set of metadata record references that have as 
     * catalog and entry the indicated by the parameters. 
     *
     * @param catalog The String that contains the catalog value
     * @param entry The String that contains the entry value   
     */
    private Set<MetadataRecordReference> queryLOByIdentifier(String catalog,
            String entry) throws Exception {
        Boolean catalogB =
                false;
        Boolean entryB =
                false;

        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();


        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasIdentifier =
                    _OntModel.getObjectProperty(_nsName + "#hasIdentifier");
            NodeIterator idInstances =
                    loInstance.listPropertyValues(hasIdentifier);
            while (idInstances.hasNext()) {
                Resource loId =
                        (Resource) idInstances.next();

                //Catalog
                Property inCatalog =
                        _OntModel.getProperty(_nsName + "#inCatalog");
                StmtIterator catalogProperties =
                        loId.listProperties(inCatalog);
                while (catalogProperties.hasNext()) {
                    Statement catalogS =
                            catalogProperties.nextStatement();
                    String catalogValue =
                            catalogS.getString();
                    if (catalogValue.compareTo(catalog) == 0) {
                        catalogB =
                                true;
                    }

                }

                //Entry
                Property isEntry =
                        _OntModel.getProperty(_nsName + "#isEntry");
                StmtIterator entryProperties =
                        loId.listProperties(isEntry);
                while (entryProperties.hasNext()) {
                    Statement entryS =
                            entryProperties.nextStatement();
                    String entryValue =
                            entryS.getString();
                    if (entryValue.compareTo(entry) == 0) {
                        entryB =
                                true;
                    }
                }

            }
            if ((catalogB) && (entryB)) {

                MetadataRecordReference mrr =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!instancesR.contains(mrr)) {
                    instancesR.add(mrr);
                }
            }
            entryB =
                    false;
            catalogB =
                    false;
        }

        return instancesR;
    }

    /**
     * This method obtains a Set of metadata record references that have as 
     * value and language the indicated by the parameters. This method is 
     * specific for langString types.  
     *
     * @param elementLOM The String that contains the element value
     * @param languageLOM The String that contains the language value
     *
     */
    private Set<MetadataRecordReference> queryLOByLangString(String elementLOM,
            String languageLOM, String elementType) {
        Boolean valueB =
                false;
        Boolean languageB =
                false;


        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();



        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasElement =
                    _OntModel.getObjectProperty(_nsName + "#" + elementType);
            NodeIterator lsInstances =
                    loInstance.listPropertyValues(hasElement);
            //for each element
            while (lsInstances.hasNext()) {
                Resource lsResource =
                        (Resource) lsInstances.next();


                //includesSingleLangString
                Property inSLS =
                        _OntModel.getProperty(_nsName +
                        "#includesSingleLangString");
                StmtIterator slsProperties =
                        lsResource.listProperties(inSLS);

                //for each instance
                while (slsProperties.hasNext()) {
                    Statement sls =
                            slsProperties.nextStatement();
                    Resource ls =
                            sls.getResource();

                    //instace of langStringSingle 
                    Individual slsIndividual =
                            _OntModel.getIndividual(_nsName + "#" +
                            ls.getLocalName());

                    //hasValue
                    Property hasValue =
                            _OntModel.getProperty(_nsName + "#hasValue");



                    RDFNode slsValues =
                            slsIndividual.getPropertyValue(hasValue);
                    String value =
                            slsValues.toString();
                    int car =
                            value.indexOf("^");
                    String hasVal =
                            value.substring(0, car);

                    if (hasVal.compareTo(elementLOM) == 0) {
                        valueB =
                                true;
                    }

                    //inLanguage
                    Property inLanguage =
                            _OntModel.getProperty(_nsName + "#inLanguage");



                    RDFNode slsLang =
                            slsIndividual.getPropertyValue(inLanguage);
                    String lang =
                            slsLang.toString();
                    int car2 =
                            lang.indexOf("^");
                    String inLang =
                            lang.substring(0, car2);

                    if (inLang.compareTo(languageLOM) == 0) {
                        languageB =
                                true;
                    }
                }


            }

            if ((languageB) && (valueB)) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }
            languageB =
                    false;
            valueB =
                    false;
        }

        return instancesR;
    }

    /**
     * This method obtains a Set of metadata record references that have as 
     * value and language the indicated by the parameters. This method is 
     * specific for langString types that have range inputs.  
     *
     * @param elementLOM The String that contains the element value
     * @param languageLOM The String that contains the language value
     * @param nsName The String that contains the nameSpace of the ontology 
     * queried
     * @param elementType The String that indicates the type of the element 
     * to query. 
     */
    private Set<MetadataRecordReference> queryLOByLangStringRange(String elementLOM,
            String languageLOM, String elementType, String ns,
            Ontology newont, String kind) {

        Boolean languageB =
                false;
        Boolean valueB =
                false;
        int comparisonMode =
                0;
        int itemValueN =
                0;
        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();

        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasElement =
                    _OntModel.getObjectProperty(_nsName + "#" + elementType);
            NodeIterator lsInstances =
                    loInstance.listPropertyValues(hasElement);
            //for each element
            while (lsInstances.hasNext()) {
                Resource ls =
                        (Resource) lsInstances.next();

                Property inIS =
                        _OntModel.getProperty(_nsName + "#hasTypicalAgeRange");
                StmtIterator isProperties =
                        ls.listProperties(inIS);

                while (isProperties.hasNext()) {

                    Statement sls =
                            isProperties.nextStatement();
                    Resource lsResource =
                            sls.getResource();


                    Property inSLS =
                            _OntModel.getProperty(_nsName +
                            "#includesSingleLangString");
                    StmtIterator slsProperties =
                            lsResource.listProperties(inSLS);

                    //for each instance
                    while (slsProperties.hasNext()) {
                        Statement slsI =
                                slsProperties.nextStatement();
                        Resource lsI =
                                slsI.getResource();

                        //instace of langStringSingle 
                        Individual slsIndividual =
                                _OntModel.getIndividual(_nsName + "#" +
                                lsI.getLocalName());

                        //hasValue
                        Property hasValue =
                                _OntModel.getProperty(_nsName + "#hasValue");



                        RDFNode slsValues =
                                slsIndividual.getPropertyValue(hasValue);
                        String value =
                                slsValues.toString();
                        int car =
                                value.indexOf("^");
                        String hasVal =
                                value.substring(0, car);

                        if (hasVal.compareTo(elementLOM) == 0) {
                            valueB =
                                    true;
                        }

                        //inLanguage
                        Property inLanguage =
                                _OntModel.getProperty(_nsName + "#inLanguage");



                        RDFNode slsLang =
                                slsIndividual.getPropertyValue(inLanguage);
                        String lang =
                                slsLang.toString();
                        int car2 =
                                lang.indexOf("^");
                        String inLang =
                                lang.substring(0, car2);

                        if (inLang.compareTo(languageLOM) == 0) {
                            languageB =
                                    true;
                        }
                    }
                }
                if ((languageB) && (valueB)) {

                    MetadataRecordReference lor =
                            new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                            loInstance.getLocalName());
                    if (!(instancesR.contains(lor))) {
                        instancesR.add(lor);
                    }
                }
                languageB =
                        false;
                valueB =
                        false;
            }
        }

        return instancesR;

    }

    /**
     * This method obtains a Set of metadata record references that have as 
     * source and value the indicated by the parameters. This method is 
     * specific for vocabularyItem types with values that indicate levels.   
     *
     * @param itemSource The String that contains the source 
     * @param itemValue The String that contains the value
     * @param nsName The String that contains the nameSpace of the ontology 
     * queried
     * @param elementType The String that indicates the type of the element 
     * to query. 
     */
    private Set<MetadataRecordReference> queryLOByVocabularyItemA(String itemValue,
            String elementType,
            String comparisonModeS) {
        Boolean sourceB =
                false;
        Boolean valueB =
                false;
        int comparisonMode =
                0;
        int itemValueN =
                0;
        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();

        if (comparisonModeS.equals("Exactly")) {
            comparisonMode =
                    1;
        } else if (comparisonModeS.equals("Less than")) {
            comparisonMode =
                    2;
        } else if (comparisonModeS.equals("Greater than")) {
            comparisonMode =
                    3;
        } else if (comparisonModeS.equals("Less than or equals")) {
            comparisonMode =
                    4;
        } else if (comparisonModeS.equals("Greater than or equals")) {
            comparisonMode =
                    5;
        } else if (comparisonModeS.equals("noCM")) {
            comparisonMode =
                    -1;
        }


        if (itemValue.equals("very low")) {
            itemValueN =
                    0;
        } else if (itemValue.equals("low")) {
            itemValueN =
                    1;
        } else if (itemValue.equals("medium")) {
            itemValueN =
                    2;
        } else if (itemValue.equals("high")) {
            itemValueN =
                    3;
        } else if (itemValue.equals("very high")) {
            itemValueN =
                    4;
        }


        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            ObjectProperty hasElement =
                    _OntModel.getObjectProperty(_nsName +
                    "#hasEducationalInformation");
            NodeIterator lsInstances =
                    loInstance.listPropertyValues(hasElement);
            //for each element
            while (lsInstances.hasNext()) {
                Resource lsResource =
                        (Resource) lsInstances.next();

                //includesSingleLangString
                Property inIS =
                        _OntModel.getProperty(_nsName + "#" + elementType);
                StmtIterator isProperties =
                        lsResource.listProperties(inIS);

                //for each instance
                while (isProperties.hasNext()) {
                    Statement sls =
                            isProperties.nextStatement();
                    String instIV =
                            sls.getString();


                    int instIVN =
                            0;

                    if (instIV.equals("very low")) {
                        instIVN =
                                0;
                    } else if (instIV.equals("low")) {
                        instIVN =
                                1;
                    } else if (instIV.equals("medium")) {
                        instIVN =
                                2;
                    } else if (instIV.equals("high")) {
                        instIVN =
                                3;
                    } else if (instIV.equals("very high")) {
                        instIVN =
                                4;
                    }

                    switch (comparisonMode) {

                        // Exactly
                        case (1): {
                            if (instIVN == itemValueN) {
                                valueB =
                                        true;
                                System.out.println("EXACTLY-> " + instIVN + "==" +
                                        itemValueN);
                            }
                            break;
                        }
                        // Less than
                        case (2): {
                            if (instIVN < itemValueN) {
                                valueB =
                                        true;
                                System.out.println("LESS-> " + instIVN + "<" +
                                        itemValueN);
                            }
                            break;
                        }
                        // Greater than
                        case (3): {
                            if (instIVN > itemValueN) {
                                valueB =
                                        true;
                                System.out.println("GREATER-> " + instIVN + ">" +
                                        itemValueN);
                            }
                            break;
                        }
                        // Less than or equals
                        case (4): {
                            if (instIVN <= itemValueN) {
                                valueB =
                                        true;
                                System.out.println("LESS OR-> " + instIVN + "<=" +
                                        itemValueN);
                            }
                            break;
                        }
                        // Greater than or equals
                        case (5): {
                            if (instIVN >= itemValueN) {
                                valueB =
                                        true;
                                System.out.println("GREATER OR-> " + instIVN +
                                        ">=" +
                                        itemValueN);
                            }
                            break;
                        }
                    }
                }
            }

            if ((valueB)) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }

            sourceB =
                    false;
            valueB =
                    false;
        }
        return instancesR;
    }

    /**
     * This method obtains a Set of metadata record references that have as 
     * source and value the indicated by the parameters. This method is 
     * specific for vocabularyItem types.  
     *
     * @param itemValue The String that contains the value
     * @param elementType The String that indicates the type of the element 
     * to query. 
     */
    private Set<MetadataRecordReference> queryLOByVocabularyItemNumber(String itemValue,
            String elementType,
            String comparisonModeS) {


        Boolean valueB =
                false;
        int comparisonMode =
                0;

        int itemValueN =
                0;
        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();




        if (comparisonModeS.equals("Exactly")) {
            comparisonMode =
                    1;
        } else if (comparisonModeS.equals("Less than")) {
            comparisonMode =
                    2;
        } else if (comparisonModeS.equals("Greater than")) {
            comparisonMode =
                    3;
        } else if (comparisonModeS.equals("Less than or equals")) {
            comparisonMode =
                    4;
        } else if (comparisonModeS.equals("Greater than or equals")) {
            comparisonMode =
                    5;
        } else if (comparisonModeS.equals("noCM")) {
            comparisonMode =
                    -1;
        }



        while (loInstances.hasNext()) {
            Individual loInstance =
                    (Individual) loInstances.next();
            Property hasElement =
                    _OntModel.getProperty(_nsName + "#" + elementType);
            System.out.println("Listando atributos: " + elementType);
            StmtIterator lsInstances =
                    loInstance.listProperties(hasElement);
            //.listPropertyValues(hasElement);
            //for each element
            while (lsInstances.hasNext()) {
                Statement idinstance =
                        lsInstances.nextStatement();
                System.out.println("instancia:" + idinstance);
                String instIV =
                        idinstance.getString();
                System.out.println("valor:" + instIV);

                int instIVN =
                        Integer.parseInt(instIV.trim());
                itemValueN =
                        Integer.parseInt(itemValue.trim());
                System.out.println("COMPARASION MODE:" + comparisonMode);
                switch (comparisonMode) {

                    // Exactly
                    case (1): {
                        if (instIVN == itemValueN) {
                            valueB =
                                    true;
                            System.out.println("EXACTLY-> " + instIVN + "==" +
                                    itemValueN);
                        }
                        break;
                    }
                    // Less than
                    case (2): {
                        if (instIVN < itemValueN) {
                            valueB =
                                    true;
                            System.out.println("LESS-> " + instIVN + "<" +
                                    itemValueN);
                        }
                        break;
                    }
                    // Greater than
                    case (3): {
                        if (instIVN > itemValueN) {
                            valueB =
                                    true;
                            System.out.println("GREATER-> " + instIVN + ">" +
                                    itemValueN);
                        }
                        break;
                    }
                    // Less than or equals
                    case (4): {
                        if (instIVN <= itemValueN) {
                            valueB =
                                    true;
                            System.out.println("LESS OR-> " + instIVN + "<=" +
                                    itemValueN);
                        }
                        break;
                    }
                    // Greater than or equals
                    case (5): {
                        if (instIVN >= itemValueN) {
                            valueB =
                                    true;
                            System.out.println("GREATER OR-> " + instIVN + ">=" +
                                    itemValueN);
                        }
                        break;
                    }
                    }

            }
            if (valueB) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }


            valueB =
                    false;
        }
        return instancesR;
    }

    /**
     * This method obtains a Set of metadata record references that have as 
     * source and value the indicated by the parameters. This method is 
     * specific for vocabularyItem types.  
     *
     * @param itemValue The String that contains the value
     * @param elementType The String that indicates the type of the element 
     * to query. 
     */
    private Set<MetadataRecordReference> queryLOByVocabularyItemString(String itemValue,
            String elementType) {
        Boolean valueB =
                false;

        Set<MetadataRecordReference> instancesR =
                new HashSet<MetadataRecordReference>();


        OntClass lo =
                _OntModel.getOntClass(_nsName + "#learningObject");
        ExtendedIterator loInstances =
                lo.listInstances();

        //for each instance
        while (loInstances.hasNext()) {

            Individual loInstance =
                    (Individual) loInstances.next();
            Property hasElement =
                    _OntModel.getProperty(_nsName + "#" + elementType);
            StmtIterator lsInstances =
                    loInstance.listProperties(hasElement);
            //for each element
            while (lsInstances.hasNext()) {
                Statement lsResource =
                        lsInstances.nextStatement();
                String val =
                        lsResource.getString();
                if (val.compareTo(itemValue) == 0) {
                    valueB =
                            true;
                }

            }

            if (valueB) {

                MetadataRecordReference lor =
                        new MetadataRecordReferenceImpl(_rep.getRepositoryURI(),
                        loInstance.getLocalName());
                if (!(instancesR.contains(lor))) {
                    instancesR.add(lor);
                }
            }

            valueB =
                    false;
        }

        return instancesR;
    }

    /**
     *
     * This operation returns the learning object title.
     * If a language string is specified, the output contains only
     * the elements in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the titles
     * of the learning object specified according to the language.
     */
    public Set<String> getLOMTitle(String loId, String language) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the title.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property titleProp =
                _OntModel.getProperty(_nsName + "#hasTitle");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");


        if (lo == null) {
            result.clear();
            return result;
        } else {
            StmtIterator titlesStmtIt =
                    lo.listProperties(titleProp);
            if (!titlesStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                if (language.compareTo("") == 0) {
                    while (titlesStmtIt.hasNext()) {
                        Statement titleStmt =
                                titlesStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (titlesStmtIt.hasNext()) {
                        Statement titleStmt =
                                titlesStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }
            }
        }

        return result;
    }

    public Set<String> getLOMLifeCycleVersion(String loId, String language) {
        return this.getLOMLangString("hasVersion", loId, language);
    }

    public Set<String> getLOMLangString(String lomAttribute, String loId,
            String language) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the title.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property titleProp =
                _OntModel.getProperty(_nsName + "#" + lomAttribute);
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");


        if (lo == null) {
            result.clear();
            return result;
        } else {
            StmtIterator titlesStmtIt =
                    lo.listProperties(titleProp);
            if (!titlesStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                if (language.compareTo("") == 0) {
                    while (titlesStmtIt.hasNext()) {
                        Statement titleStmt =
                                titlesStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (titlesStmtIt.hasNext()) {
                        Statement titleStmt =
                                titlesStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMDescription(String loId, String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {
            StmtIterator descriptionsStmtIt =
                    lo.listProperties(descrProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement titleStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     *
     * This operation returns a collection of learning object keywords.
     * If a language instance is specified, the output contains only
     * the element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String </CODE> that contains the
     * keywords of the learning object according to the language.
     */
    public Set<String> getLOMKeywords(String loId, String language) {
        Set<String> result =
                new LinkedHashSet<String>();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property keywordProp =
                _OntModel.getProperty(_nsName + "#hasKeyword");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {
            StmtIterator keywordsStmtIt =
                    lo.listProperties(keywordProp);
            if (!keywordsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (keywordsStmtIt.hasNext()) {
                        Statement keywordStmt =
                                keywordsStmtIt.nextStatement();
                        Resource lsRes =
                                keywordStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (keywordsStmtIt.hasNext()) {
                        Statement titleStmt =
                                keywordsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object technical duration.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * languages of the learning object specified.
     */
    public String getLOMDuration(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property durationProp =
                _OntModel.getProperty(_nsName + "#hasDuration");
        Property durationValProp =
                _OntModel.getProperty(_nsName + "#hasDurationValue");

        String durationVal =
                "";

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator durationIt =
                    lo.listProperties(durationProp);

            if (!durationIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtDuration =
                        durationIt.nextStatement();
                Resource durationRes =
                        stmtDuration.getResource();

                StmtIterator durValIt =
                        durationRes.listProperties(durationValProp);

                if (!durValIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    Statement stmtDurVal =
                            durValIt.nextStatement();
                    durationVal =
                            stmtDurVal.getString();
                }

                result =
                        durationVal;
            }

        }

        return result;
    }

    public String getLOMEducationalTypicalLearningTimeValue(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property tltProp =
                _OntModel.getProperty(_nsName + "#hasTypicalLearningTime");
        Property durationValProp =
                _OntModel.getProperty(_nsName + "#hasDurationValue");

        String durationVal =
                "";




        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator eduIt =
                    lo.listProperties(educationalProp);

            if (!eduIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement eduStmt =
                        eduIt.nextStatement();
                Resource eduRes =
                        eduStmt.getResource();

                StmtIterator tltStIt =
                        eduRes.listProperties(tltProp);
                if (!tltStIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (tltStIt.hasNext()) {
                        Statement tltStmt =
                                tltStIt.nextStatement();
                        Resource tltRes =
                                tltStmt.getResource();
                        StmtIterator durValIt =
                                tltRes.listProperties(durationValProp);


                        if (!durValIt.hasNext()) {
                            result =
                                    "";
                            return result;
                        } else {
                            Statement stmtDurVal =
                                    durValIt.nextStatement();
                            durationVal =
                                    stmtDurVal.getString();
                        }

                        result =
                                durationVal;
                    }
                }
            }
        }

        return result;
    }

    public String getLOMEducationalTypicalLearningTimeValue(String loId,
            String educationalId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalRes =
                _OntModel.getResource(educationalId);


        Property tltProp =
                _OntModel.getProperty(_nsName + "#hasTypicalLearningTime");
        Property durationValProp =
                _OntModel.getProperty(_nsName + "#hasDurationValue");

        String durationVal =
                "";




        if (educationalRes == null) {
            result =
                    "";
            return result;
        } else {



            StmtIterator tltStIt =
                    educationalRes.listProperties(tltProp);
            if (!tltStIt.hasNext()) {
                result =
                        "";
                return result;
            } else {
                while (tltStIt.hasNext()) {
                    Statement tltStmt =
                            tltStIt.nextStatement();
                    Resource tltRes =
                            tltStmt.getResource();
                    StmtIterator durValIt =
                            tltRes.listProperties(durationValProp);


                    if (!durValIt.hasNext()) {
                        result =
                                "";
                        return result;
                    } else {
                        Statement stmtDurVal =
                                durValIt.nextStatement();
                        durationVal =
                                stmtDurVal.getString();
                    }

                    result =
                            durationVal;
                }
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object duration description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMEducationalTypicalLearningTimeDescription(String loId,
            String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property tltProp =
                _OntModel.getProperty(_nsName + "#hasTypicalLearningTime");


        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDurationDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator eduIt =
                    lo.listProperties(educationalProp);

            if (!eduIt.hasNext()) {
                result.add("");
                return result;
            } else {

                Statement eduStmt =
                        eduIt.nextStatement();
                Resource eduRes =
                        eduStmt.getResource();

                StmtIterator tltStIt =
                        eduRes.listProperties(tltProp);
                if (!tltStIt.hasNext()) {
                    result.add("");
                    return result;
                } else {
                    while (tltStIt.hasNext()) {
                        Statement tltStmt =
                                tltStIt.nextStatement();
                        Resource tltRes =
                                tltStmt.getResource();
                        StmtIterator descriptionsStmtIt =
                                tltRes.listProperties(descrProp);
                        if (!descriptionsStmtIt.hasNext()) {
                            result.clear();
                            return result;
                        } else {
                            if (language.compareTo("") == 0) {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement descrStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            descrStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itChar.hasNext()) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }

                                }
                            } else {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement titleStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            titleStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itLang =
                                                singleLSInst.listProperties(inLanguageProp);
                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itLang.hasNext()) {
                                            Statement stmtLang =
                                                    itLang.nextStatement();
                                            String languageS =
                                                    stmtLang.getString();
                                            if ((languageS.compareTo(language) ==
                                                    0) ||
                                                    (language.compareTo("") == 0)) {
                                                Statement stmtChar =
                                                        itChar.nextStatement();
                                                String charS =
                                                        stmtChar.getString();
                                                result.add(charS);
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object duration description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMEducationalTypicalLearningTimeDescription(String loId,
            String language, String educationalId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalRes =
                _OntModel.getResource(educationalId);


        Property tltProp =
                _OntModel.getProperty(_nsName + "#hasTypicalLearningTime");


        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDurationDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (educationalRes == null) {
            result.clear();
            return result;
        } else {

            StmtIterator tltStIt =
                    educationalRes.listProperties(tltProp);
            if (!tltStIt.hasNext()) {
                result.add("");
                return result;
            } else {
                while (tltStIt.hasNext()) {
                    Statement tltStmt =
                            tltStIt.nextStatement();
                    Resource tltRes =
                            tltStmt.getResource();
                    StmtIterator descriptionsStmtIt =
                            tltRes.listProperties(descrProp);
                    if (!descriptionsStmtIt.hasNext()) {
                        result.clear();
                        return result;
                    } else {
                        if (language.compareTo("") == 0) {
                            while (descriptionsStmtIt.hasNext()) {
                                Statement descrStmt =
                                        descriptionsStmtIt.nextStatement();
                                Resource lsRes =
                                        descrStmt.getResource();
                                StmtIterator singleStmtIt =
                                        lsRes.listProperties(singleLSProp);
                                while (singleStmtIt.hasNext()) {
                                    Statement singleLSStmt =
                                            singleStmtIt.nextStatement();
                                    Resource singleLSRes =
                                            singleLSStmt.getResource();

                                    Individual singleLSInst =
                                            _OntModel.getIndividual(singleLSRes.getURI());

                                    StmtIterator itChar =
                                            singleLSInst.listProperties(hasValueProp);

                                    while (itChar.hasNext()) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        } else {
                            while (descriptionsStmtIt.hasNext()) {
                                Statement titleStmt =
                                        descriptionsStmtIt.nextStatement();
                                Resource lsRes =
                                        titleStmt.getResource();
                                StmtIterator singleStmtIt =
                                        lsRes.listProperties(singleLSProp);
                                while (singleStmtIt.hasNext()) {
                                    Statement singleLSStmt =
                                            singleStmtIt.nextStatement();
                                    Resource singleLSRes =
                                            singleLSStmt.getResource();

                                    Individual singleLSInst =
                                            _OntModel.getIndividual(singleLSRes.getURI());

                                    StmtIterator itLang =
                                            singleLSInst.listProperties(inLanguageProp);
                                    StmtIterator itChar =
                                            singleLSInst.listProperties(hasValueProp);

                                    while (itLang.hasNext()) {
                                        Statement stmtLang =
                                                itLang.nextStatement();
                                        String languageS =
                                                stmtLang.getString();
                                        if ((languageS.compareTo(language) == 0) ||
                                                (language.compareTo("") == 0)) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }

                                }
                            }
                        }
                    }
                }
            }

        }
        return result;
    }

    /**
     * This operation returns a learning object duration description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMDurationDescription(String loId, String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property durationProp =
                _OntModel.getProperty(_nsName + "#hasDuration");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDurationDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(durationProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator descriptionsStmtIt =
                        durRes.listProperties(descrProp);
                if (!descriptionsStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    if (language.compareTo("") == 0) {
                        while (descriptionsStmtIt.hasNext()) {
                            Statement descrStmt =
                                    descriptionsStmtIt.nextStatement();
                            Resource lsRes =
                                    descrStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itChar.hasNext()) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    } else {
                        while (descriptionsStmtIt.hasNext()) {
                            Statement titleStmt =
                                    descriptionsStmtIt.nextStatement();
                            Resource lsRes =
                                    titleStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itLang =
                                        singleLSInst.listProperties(inLanguageProp);
                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itLang.hasNext()) {
                                    Statement stmtLang =
                                            itLang.nextStatement();
                                    String languageS =
                                            stmtLang.getString();
                                    if ((languageS.compareTo(language) == 0) ||
                                            (language.compareTo("") == 0)) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object rights description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMRightsDescription(String loId, String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasCommentsOnConditionsOfUse");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {
            StmtIterator descriptionsStmtIt =
                    lo.listProperties(descrProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement titleStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     * This operation returns the learning object coverage.
     * If a language instance is specified, the output contains only
     * the element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the coverage
     * of the learning object specified according to the language.
     */
    public Set<String> getLOMCoverage(String loId, String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property coverageProp =
                _OntModel.getProperty(_nsName + "#hasCoverage");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {
            StmtIterator descriptionsStmtIt =
                    lo.listProperties(coverageProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement titleStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }
            }
        }

        return result;

    }

    /**
     * This operation returns the learning object coverage.
     * If a language instance is specified, the output contains only
     * the element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the coverage
     * of the learning object specified according to the language.
     */
    public Set<String> getLOMInstallationRemarks(String loId, String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property installProp =
                _OntModel.getProperty(_nsName + "#hasInstallationRemark");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {
            StmtIterator descriptionsStmtIt =
                    lo.listProperties(installProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement titleStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }
            }
        }

        return result;

    }

    /**
     * This operation returns the learning object platform requirements.
     * If a language instance is specified, the output contains only
     * the element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the coverage
     * of the learning object specified according to the language.
     */
    public Set<String> getLOMOtherPlatformRequirements(String loId,
            String language) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property platformRProp =
                _OntModel.getProperty(_nsName + "#hasOtherPlatformRequirement");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {
            StmtIterator descriptionsStmtIt =
                    lo.listProperties(platformRProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement titleStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }
            }
        }

        return result;
    }

    public String getLOMEducationalLearningResourceType(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);


        Property relationProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property structureProp =
                _OntModel.getProperty(_nsName + "#hasLearningResourceType");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator relationStmtIt =
                    lo.listProperties(relationProp);
            if (!relationStmtIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement relationStmt =
                        relationStmtIt.nextStatement();
                Resource relationRes =
                        relationStmt.getResource();

                StmtIterator structureIt =
                        relationRes.listProperties(structureProp);

                if (!structureIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtStructure =
                            structureIt.nextStatement();
                    result =
                            stmtStructure.getString();
                }
            }
        }

        return result;
    }

    public String getLOMEducationalLearningResourceType(String loId,
            String educationalInstanceId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalInstance =
                _OntModel.getResource(educationalInstanceId);
        Property structureProp =
                _OntModel.getProperty(_nsName + "#hasLearningResourceType");

        if (educationalInstance == null) {
            result =
                    "";
            return result;
        } else {
            StmtIterator structureIt =
                    educationalInstance.listProperties(structureProp);

            if (!structureIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtStructure =
                        structureIt.nextStatement();
                result =
                        stmtStructure.getString();

            }
        }

        return result;
    }

    public String getLOMEducationalContext(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);


        Property relationProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property structureProp =
                _OntModel.getProperty(_nsName + "#isIntendedForContext");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator relationStmtIt =
                    lo.listProperties(relationProp);
            if (!relationStmtIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement relationStmt =
                        relationStmtIt.nextStatement();
                Resource relationRes =
                        relationStmt.getResource();

                StmtIterator structureIt =
                        relationRes.listProperties(structureProp);

                if (!structureIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtStructure =
                            structureIt.nextStatement();
                    result =
                            stmtStructure.getString();
                }
            }
        }

        return result;
    }

    public String getLOMEducationalContext(String loId,
            String educationalInstanceId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalRes =
                _OntModel.getResource(educationalInstanceId);



        Property structureProp =
                _OntModel.getProperty(_nsName + "#isIntendedForContext");

        if (educationalRes == null) {
            result =
                    "";
            return result;
        } else {


            StmtIterator structureIt =
                    educationalRes.listProperties(structureProp);

            if (!structureIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtStructure =
                        structureIt.nextStatement();
                result =
                        stmtStructure.getString();
            }
        }


        return result;
    }

    /**
     * This operation returns a learning object educational description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMEducationalDescription(String loId,
            String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDescriptionOnUse");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(educationalProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator descriptionsStmtIt =
                        durRes.listProperties(descrProp);
                if (!descriptionsStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    if (language.compareTo("") == 0) {
                        while (descriptionsStmtIt.hasNext()) {
                            Statement descrStmt =
                                    descriptionsStmtIt.nextStatement();
                            Resource lsRes =
                                    descrStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itChar.hasNext()) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    } else {
                        while (descriptionsStmtIt.hasNext()) {
                            Statement titleStmt =
                                    descriptionsStmtIt.nextStatement();
                            Resource lsRes =
                                    titleStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itLang =
                                        singleLSInst.listProperties(inLanguageProp);
                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itLang.hasNext()) {
                                    Statement stmtLang =
                                            itLang.nextStatement();
                                    String languageS =
                                            stmtLang.getString();
                                    if ((languageS.compareTo(language) == 0) ||
                                            (language.compareTo("") == 0)) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object educational description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMEducationalDescription(String loId,
            String language, String educationalId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource eduRes =
                _OntModel.getResource(educationalId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDescriptionOnUse");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (eduRes == null) {
            result.clear();
            return result;
        } else {



            StmtIterator descriptionsStmtIt =
                    eduRes.listProperties(descrProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement titleStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }

            }
        }
        return result;
    }

    public Set<String> getLOMSpecificInstances(String loId, String kind) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#" + kind);
        //"#hasEducationalInformation");

        if (lo == null) {
            result.add("");
            return result;
        } else {

            StmtIterator instancesStmtIt =
                    lo.listProperties(educationalProp);
            if (instancesStmtIt.hasNext()) {
                while (instancesStmtIt.hasNext()) {
                    Statement instanceStmt =
                            instancesStmtIt.nextStatement();
                    String instanceId =
                            instanceStmt.getResource().getLocalName().toString();
                    result.add(_nsName + "#" + instanceId);
                }
            } else {
                result.add("");
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object educational typical age range.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMTypicalAgeRange(String loId, String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property typicalARProp =
                _OntModel.getProperty(_nsName + "#hasTypicalAgeRange");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(educationalProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator descriptionsStmtIt =
                        durRes.listProperties(typicalARProp);
                if (!descriptionsStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    if (language.compareTo("") == 0) {
                        while (descriptionsStmtIt.hasNext()) {
                            Statement descrStmt =
                                    descriptionsStmtIt.nextStatement();
                            Resource lsRes =
                                    descrStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itChar.hasNext()) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    } else {
                        while (descriptionsStmtIt.hasNext()) {
                            Statement titleStmt =
                                    descriptionsStmtIt.nextStatement();
                            Resource lsRes =
                                    titleStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itLang =
                                        singleLSInst.listProperties(inLanguageProp);
                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itLang.hasNext()) {
                                    Statement stmtLang =
                                            itLang.nextStatement();
                                    String languageS =
                                            stmtLang.getString();
                                    if ((languageS.compareTo(language) == 0) ||
                                            (language.compareTo("") == 0)) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    public Set<String> getLOMTypicalAgeRange(String loId, String language,
            String educationalId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalRes =
                _OntModel.getResource(educationalId);


        Property typicalARProp =
                _OntModel.getProperty(_nsName + "#hasTypicalAgeRange");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (educationalRes == null) {
            result.clear();
            return result;
        } else {

            StmtIterator descriptionsStmtIt =
                    educationalRes.listProperties(typicalARProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement titleStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }

            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object aggregation level value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the 
     * aggregation level value of the learning object specified.
     */
    public String getLOMAggregationLevel(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);
        Property aggregationProp =
                _OntModel.getProperty(_nsName + "#hasAggregationLevel");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator aggregationIt =
                    lo.listProperties(aggregationProp);

            if (!aggregationIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtAggregation =
                        aggregationIt.nextStatement();
                result =
                        stmtAggregation.getString();
            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object copyright restrictions value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMCopyRightRestrictions(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property copyrightProp =
                _OntModel.getProperty(_nsName + "#hasCopyrightRestrictions");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator copyrightIt =
                    lo.listProperties(copyrightProp);

            if (!copyrightIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtCopyright =
                        copyrightIt.nextStatement();
                result =
                        stmtCopyright.getString();
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object cost value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMCost(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property costProp =
                _OntModel.getProperty(_nsName + "#hasCost");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator costIt =
                    lo.listProperties(costProp);

            if (!costIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtCost =
                        costIt.nextStatement();
                result =
                        stmtCost.getString();
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object size value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMSize(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property sizeProp =
                _OntModel.getProperty(_nsName + "#hasSize");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator sizeIt =
                    lo.listProperties(sizeProp);

            if (!sizeIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtSize =
                        sizeIt.nextStatement();
                result =
                        stmtSize.getString();
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object status value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMStatus(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property statusProp =
                _OntModel.getProperty(_nsName + "#hasStatus");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator statusIt =
                    lo.listProperties(statusProp);

            if (!statusIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtStatus =
                        statusIt.nextStatement();
                result =
                        stmtStatus.getString();
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object structure value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMStructure(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property structureProp =
                _OntModel.getProperty(_nsName + "#hasStructure");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator structureIt =
                    lo.listProperties(structureProp);

            if (!structureIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtStructure =
                        structureIt.nextStatement();
                result =
                        stmtStructure.getString();
            }
        }

        return result;
    }

    public String getLOMMetadataContributorRole(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);


        Property relationProp =
                _OntModel.getProperty(_nsName + "#metadataHasContribution");
        Property structureProp =
                _OntModel.getProperty(_nsName + "#hasmetadataContributionRole");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator relationStmtIt =
                    lo.listProperties(relationProp);
            if (!relationStmtIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement relationStmt =
                        relationStmtIt.nextStatement();
                Resource relationRes =
                        relationStmt.getResource();

                StmtIterator structureIt =
                        relationRes.listProperties(structureProp);

                if (!structureIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtStructure =
                            structureIt.nextStatement();
                    result =
                            stmtStructure.getString();
                }
            }
        }

        return result;
    }

    public String getLOMLifeCycleContributorRole(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);


        Property relationProp =
                _OntModel.getProperty(_nsName + "#hasContribution");
        Property structureProp =
                _OntModel.getProperty(_nsName + "#hasmetadataContributionRole");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator relationStmtIt =
                    lo.listProperties(relationProp);
            if (!relationStmtIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement relationStmt =
                        relationStmtIt.nextStatement();
                Resource relationRes =
                        relationStmt.getResource();

                StmtIterator structureIt =
                        relationRes.listProperties(structureProp);

                if (!structureIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtStructure =
                            structureIt.nextStatement();
                    result =
                            stmtStructure.getString();
                }
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object metadata language value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMMetadataLanguage(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property metadataLangProp =
                _OntModel.getProperty(_nsName + "#metadataInLanguage");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator metadataLangIt =
                    lo.listProperties(metadataLangProp);

            if (!metadataLangIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtMetadataLang =
                        metadataLangIt.nextStatement();
                result =
                        stmtMetadataLang.getString();
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object metadata schema value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMMetadataSchema(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property metadataSchemaProp =
                _OntModel.getProperty(_nsName + "#hasMetadataSchema");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator metadataSchemaIt =
                    lo.listProperties(metadataSchemaProp);

            if (!metadataSchemaIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtMetadataSchema =
                        metadataSchemaIt.nextStatement();
                result =
                        stmtMetadataSchema.getString();
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object location value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMLocation(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property locationProp =
                _OntModel.getProperty(_nsName + "#isLocated");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator locationIt =
                    lo.listProperties(locationProp);

            if (!locationIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtLocation =
                        locationIt.nextStatement();
                result =
                        stmtLocation.getString();
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object language value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMLanguage(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property languageProp =
                _OntModel.getProperty(_nsName + "#hasLanguage");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator languageIt =
                    lo.listProperties(languageProp);

            if (!languageIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtLanguage =
                        languageIt.nextStatement();
                result =
                        stmtLanguage.getString();
            }
        }

        return result;
    }

    public String getLOMTechnicalRequirementType(String loId) {
        return this.getLOMTechnicalRequirementElement(loId, "hasType");
    }

    public String getLOMTechnicalRequirementMinVersion(String loId) {
        return this.getLOMTechnicalRequirementElement(loId, "minVersion");
    }

    public String getLOMTechnicalRequirementMaxVersion(String loId) {
        return this.getLOMTechnicalRequirementElement(loId, "maxVersion");
    }

    public String getLOMTechnicalRequirementName(String loId) {
        return this.getLOMTechnicalRequirementElement(loId, "requirementName");
    }

    public String getLOMTechnicalRequirementElement(String loId, String element) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasTechnicalRequirement");
        Property entityProp =
                _OntModel.getProperty(_nsName + "#isCompositeOf");
        Property emailProp =
                _OntModel.getProperty(_nsName + "#" + element);

        String emailVal =
                "";

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator annotaionIt =
                    lo.listProperties(annotationProp);

            if (!annotaionIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtAnnotation =
                        annotaionIt.nextStatement();
                Resource annotationRes =
                        stmtAnnotation.getResource();

                StmtIterator entityIt =
                        annotationRes.listProperties(entityProp);


                if (!entityIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtEntity =
                            entityIt.nextStatement();
                    Resource entityRes =
                            stmtEntity.getResource();

                    StmtIterator emailIt =
                            entityRes.listProperties(emailProp);

                    if (!emailIt.hasNext()) {
                        result =
                                "";
                        return result;
                    } else {
                        Statement stmtDurVal =
                                emailIt.nextStatement();
                        emailVal =
                                stmtDurVal.getString();
                    }

                    result =
                            emailVal;
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object technical format value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMTechnicalFormat(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property formatProp =
                _OntModel.getProperty(_nsName + "#hasFormat");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator formatIt =
                    lo.listProperties(formatProp);

            if (!formatIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtFormat =
                        formatIt.nextStatement();
                result =
                        stmtFormat.getString();
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object catalog from the identifier.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMGeneralCatalogIdentifier(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property identifierProp =
                _OntModel.getProperty(_nsName + "#hasIdentifier");
        Property catalogProp =
                _OntModel.getProperty(_nsName + "#inCatalog");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator identifierIt =
                    lo.listProperties(identifierProp);

            if (!identifierIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtIdentifier =
                        identifierIt.nextStatement();
                Resource identRes =
                        stmtIdentifier.getResource();

                StmtIterator catalogIt =
                        identRes.listProperties(catalogProp);

                if (!catalogIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (catalogIt.hasNext()) {
                        Statement stmtCatalog =
                                catalogIt.nextStatement();
                        result =
                                stmtCatalog.getString();
                    }
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object entry from the identifier.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMGeneralEntryIdentifier(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property identifierProp =
                _OntModel.getProperty(_nsName + "#hasIdentifier");
        Property entryProp =
                _OntModel.getProperty(_nsName + "#isEntry");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator identifierIt =
                    lo.listProperties(identifierProp);

            if (!identifierIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtIdentifier =
                        identifierIt.nextStatement();
                Resource identRes =
                        stmtIdentifier.getResource();

                StmtIterator entryIt =
                        identRes.listProperties(entryProp);

                if (!entryIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (entryIt.hasNext()) {
                        Statement stmtEntry =
                                entryIt.nextStatement();
                        result =
                                stmtEntry.getString();
                    }
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object metadata catalog from the 
     * metadata record identifier.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMMetadataCatalogIdentifier(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property identifierProp =
                _OntModel.getProperty(_nsName + "#hasMetadataIdentifier");
        Property catalogProp =
                _OntModel.getProperty(_nsName + "#inCatalog");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator identifierIt =
                    lo.listProperties(identifierProp);

            if (!identifierIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtIdentifier =
                        identifierIt.nextStatement();
                Resource identRes =
                        stmtIdentifier.getResource();

                StmtIterator catalogIt =
                        identRes.listProperties(catalogProp);

                if (!catalogIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (catalogIt.hasNext()) {
                        Statement stmtCatalog =
                                catalogIt.nextStatement();
                        result =
                                stmtCatalog.getString();
                    }
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object metadata entry from the metadata
     * record identifier.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMMetadataEntryIdentifier(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property identifierProp =
                _OntModel.getProperty(_nsName + "#hasMetadataIdentifier");
        Property entryProp =
                _OntModel.getProperty(_nsName + "#isEntry");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator identifierIt =
                    lo.listProperties(identifierProp);

            if (!identifierIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtIdentifier =
                        identifierIt.nextStatement();
                Resource identRes =
                        stmtIdentifier.getResource();

                StmtIterator entryIt =
                        identRes.listProperties(entryProp);

                if (!entryIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (entryIt.hasNext()) {
                        Statement stmtEntry =
                                entryIt.nextStatement();
                        result =
                                stmtEntry.getString();
                    }
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object educational difficulty value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalDifficulty(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasDifficulty");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator educationalIt =
                    lo.listProperties(educationalProp);

            if (!educationalIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtEducational =
                        educationalIt.nextStatement();
                Resource educationalRes =
                        stmtEducational.getResource();

                StmtIterator difficultyIt =
                        educationalRes.listProperties(difficultyProp);

                if (!difficultyIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (difficultyIt.hasNext()) {
                        Statement stmtDifficulty =
                                difficultyIt.nextStatement();
                        result =
                                stmtDifficulty.getString();
                    }
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object educational difficulty value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalDifficulty(String loId, String educationalId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalRes =
                _OntModel.getResource(educationalId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasDifficulty");

        if (educationalRes == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator difficultyIt =
                    educationalRes.listProperties(difficultyProp);

            if (!difficultyIt.hasNext()) {
                result =
                        "";
                return result;
            } else {
                while (difficultyIt.hasNext()) {
                    Statement stmtDifficulty =
                            difficultyIt.nextStatement();
                    result =
                            stmtDifficulty.getString();
                }
            }


        }

        return result;
    }

    /**
     *
     * This operation returns the learning object educational interactivity level.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalInteractivityLevel(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasInteractivityLevel");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator educationalIt =
                    lo.listProperties(educationalProp);

            if (!educationalIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtEducational =
                        educationalIt.nextStatement();
                Resource educationalRes =
                        stmtEducational.getResource();

                StmtIterator difficultyIt =
                        educationalRes.listProperties(difficultyProp);

                if (!difficultyIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (difficultyIt.hasNext()) {
                        Statement stmtDifficulty =
                                difficultyIt.nextStatement();
                        result =
                                stmtDifficulty.getString();
                    }
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object educational interactivity level.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalInteractivityLevel(String loId,
            String educationalInstanceId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalInstance =
                _OntModel.getIndividual(educationalInstanceId);


        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasInteractivityLevel");

        if (educationalInstance == null) {
            result =
                    "";
            return result;
        } else {



            StmtIterator difficultyIt =
                    educationalInstance.listProperties(difficultyProp);

            if (!difficultyIt.hasNext()) {
                result =
                        "";
                return result;
            } else {
                while (difficultyIt.hasNext()) {
                    Statement stmtDifficulty =
                            difficultyIt.nextStatement();
                    result =
                            stmtDifficulty.getString();
                }
            }

        }

        return result;
    }

    /**
     *
     * This operation returns the learning object educational interactivity type 
     * value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalInteractivityType(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasInteractivityType");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator educationalIt =
                    lo.listProperties(educationalProp);

            if (!educationalIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtEducational =
                        educationalIt.nextStatement();
                Resource educationalRes =
                        stmtEducational.getResource();

                StmtIterator difficultyIt =
                        educationalRes.listProperties(difficultyProp);

                if (!difficultyIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (difficultyIt.hasNext()) {
                        Statement stmtDifficulty =
                                difficultyIt.nextStatement();
                        result =
                                stmtDifficulty.getString();
                    }
                }

            }
        }

        return result;
    }

    public String getLOMEducationalInteractivityType(String loId,
            String educationalInstanceId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }



        Resource educationalInstance =
                _OntModel.getResource(educationalInstanceId);
        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasInteractivityType");

        if (educationalInstance == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator difficultyIt =
                    educationalInstance.listProperties(difficultyProp);

            if (!difficultyIt.hasNext()) {
                result =
                        "";
                return result;
            } else {
                while (difficultyIt.hasNext()) {
                    Statement stmtDifficulty =
                            difficultyIt.nextStatement();
                    result =
                            stmtDifficulty.getString();
                }
            }
        }

        return result;
    }

    public String getLOMEducationalIntendedUserRole(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#isIntendedForUserRole");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator educationalIt =
                    lo.listProperties(educationalProp);

            if (!educationalIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtEducational =
                        educationalIt.nextStatement();
                Resource educationalRes =
                        stmtEducational.getResource();

                StmtIterator difficultyIt =
                        educationalRes.listProperties(difficultyProp);

                if (!difficultyIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (difficultyIt.hasNext()) {
                        Statement stmtDifficulty =
                                difficultyIt.nextStatement();
                        result =
                                stmtDifficulty.getString();
                    }
                }

            }
        }

        return result;
    }

    public String getLOMEducationalIntendedUserRole(String loId,
            String educationalInstanceId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalResource =
                _OntModel.getIndividual(educationalInstanceId);


        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#isIntendedForUserRole");

        if (educationalResource == null) {
            result =
                    "";
            return result;
        } else {



            StmtIterator difficultyIt =
                    educationalResource.listProperties(difficultyProp);

            if (!difficultyIt.hasNext()) {
                result =
                        "";
                return result;
            } else {
                while (difficultyIt.hasNext()) {
                    Statement stmtDifficulty =
                            difficultyIt.nextStatement();
                    result =
                            stmtDifficulty.getString();
                }
            }


        }

        return result;
    }

    /**
     *
     * This operation returns the learning object educational semantic density
     * value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalSemanticDensity(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasSemanticDensity");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator educationalIt =
                    lo.listProperties(educationalProp);

            if (!educationalIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtEducational =
                        educationalIt.nextStatement();
                Resource educationalRes =
                        stmtEducational.getResource();

                StmtIterator difficultyIt =
                        educationalRes.listProperties(difficultyProp);

                if (!difficultyIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (difficultyIt.hasNext()) {
                        Statement stmtDifficulty =
                                difficultyIt.nextStatement();
                        result =
                                stmtDifficulty.getString();
                    }
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object educational semantic density
     * value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalSemanticDensity(String loId,
            String educationalInstanceId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalResource =
                _OntModel.getResource(educationalInstanceId);


        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasSemanticDensity");

        if (educationalResource == null) {
            result =
                    "";
            return result;
        } else {



            StmtIterator difficultyIt =
                    educationalResource.listProperties(difficultyProp);

            if (!difficultyIt.hasNext()) {
                result =
                        "";
                return result;
            } else {
                while (difficultyIt.hasNext()) {
                    Statement stmtDifficulty =
                            difficultyIt.nextStatement();
                    result =
                            stmtDifficulty.getString();
                }
            }

        }


        return result;
    }

    /**
     *
     * This operation returns the learning object educational human language
     * value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalHumanLanguage(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property educationalProp =
                _OntModel.getProperty(_nsName + "#hasEducationalInformation");
        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasHumanLanguage");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator educationalIt =
                    lo.listProperties(educationalProp);

            if (!educationalIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtEducational =
                        educationalIt.nextStatement();
                Resource educationalRes =
                        stmtEducational.getResource();

                StmtIterator difficultyIt =
                        educationalRes.listProperties(difficultyProp);

                if (!difficultyIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (difficultyIt.hasNext()) {
                        Statement stmtDifficulty =
                                difficultyIt.nextStatement();
                        result =
                                stmtDifficulty.getString();
                    }
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object educational human language
     * value.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMEducationalHumanLanguage(String loId,
            String educationalId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource educationalRes =
                _OntModel.getResource(educationalId);


        Property difficultyProp =
                _OntModel.getProperty(_nsName + "#hasHumanLanguage");

        if (educationalRes == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator difficultyIt =
                    educationalRes.listProperties(difficultyProp);

            if (!difficultyIt.hasNext()) {
                result =
                        "";
                return result;
            } else {
                while (difficultyIt.hasNext()) {
                    Statement stmtDifficulty =
                            difficultyIt.nextStatement();
                    result =
                            stmtDifficulty.getString();
                }
            }

        }


        return result;
    }

    public String getLOMRelationKind(String loId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);


        Property relationProp =
                _OntModel.getProperty(_nsName + "#hasRelation");
        Property structureProp =
                _OntModel.getProperty(_nsName + "#relationKind");

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator relationStmtIt =
                    lo.listProperties(relationProp);
            if (!relationStmtIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement relationStmt =
                        relationStmtIt.nextStatement();
                Resource relationRes =
                        relationStmt.getResource();

                StmtIterator structureIt =
                        relationRes.listProperties(structureProp);

                if (!structureIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtStructure =
                            structureIt.nextStatement();
                    result =
                            stmtStructure.getString();
                }
            }
        }

        return result;
    }

    public String getLOMRelationKind(String loId, String relationId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource relationRes =
                _OntModel.getResource(relationId);

        Property structureProp =
                _OntModel.getProperty(_nsName + "#relationKind");

        if (relationRes == null) {
            result =
                    "";
            return result;
        } else {


            StmtIterator structureIt =
                    relationRes.listProperties(structureProp);

            if (!structureIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtStructure =
                        structureIt.nextStatement();
                result =
                        stmtStructure.getString();
            }

        }

        return result;
    }

    public Set<String> getLOMRelationResourceDescription(String loId,
            String language) {
        return this.getLOMRelationResourceElement(loId, language,
                "hasResourceDescription");
    }

    public Set<String> getLOMRelationResourceDescription(String loId,
            String language, String relationId) {
        return this.getLOMRelationResourceElement(loId, language,
                "hasResourceDescription", relationId);
    }

    public String getLOMRelationResourceIdentifierCatalog(String loId) {
        return this.getLOMRelationResourceIdentifierElement(loId, "inCatalog");
    }

    public String getLOMRelationResourceIdentifierCatalog(String loId,
            String relationId) {
        return this.getLOMRelationResourceIdentifierElement(loId, "inCatalog",
                relationId);
    }

    public String getLOMRelationResourceIdentifierEntry(String loId) {
        return this.getLOMRelationResourceIdentifierElement(loId, "isEntry");
    }

    public String getLOMRelationResourceIdentifierEntry(String loId,
            String relationId) {
        return this.getLOMRelationResourceIdentifierElement(loId, "isEntry",
                relationId);
    }

    /**
     *
     * This operation returns the learning object metadata catalog from the 
     * metadata record identifier.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMRelationResourceIdentifierElement(String loId,
            String element) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property relationProp =
                _OntModel.getProperty(_nsName + "#hasRelation");
        Property resourceProp =
                _OntModel.getProperty(_nsName + "#relatedResource");
        Property identifierProp =
                _OntModel.getProperty(_nsName + "#hasResourceIdentifier");
        Property catalogProp =
                _OntModel.getProperty(_nsName + "#" + element);

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator relationStmtIt =
                    lo.listProperties(relationProp);
            if (!relationStmtIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement relationStmt =
                        relationStmtIt.nextStatement();
                Resource relationRes =
                        relationStmt.getResource();

                StmtIterator resourceStmtIt =
                        relationRes.listProperties(resourceProp);
                if (!resourceStmtIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    while (resourceStmtIt.hasNext()) {
                        Statement resourceStmt =
                                resourceStmtIt.nextStatement();
                        Resource resourceRes =
                                resourceStmt.getResource();
                        StmtIterator identifierIt =
                                resourceRes.listProperties(identifierProp);
                        if (!identifierIt.hasNext()) {
                            result =
                                    "";
                            return result;
                        } else {

                            Statement stmtIdentifier =
                                    identifierIt.nextStatement();
                            Resource identRes =
                                    stmtIdentifier.getResource();

                            StmtIterator catalogIt =
                                    identRes.listProperties(catalogProp);

                            if (!catalogIt.hasNext()) {
                                result =
                                        "";
                                return result;
                            } else {
                                while (catalogIt.hasNext()) {
                                    Statement stmtCatalog =
                                            catalogIt.nextStatement();
                                    result =
                                            stmtCatalog.getString();
                                }
                            }

                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object metadata catalog from the 
     * metadata record identifier.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * co of the learning object specified.
     */
    public String getLOMRelationResourceIdentifierElement(String loId,
            String element, String relationId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource relationRes =
                _OntModel.getResource(relationId);


        Property resourceProp =
                _OntModel.getProperty(_nsName + "#relatedResource");
        Property identifierProp =
                _OntModel.getProperty(_nsName + "#hasResourceIdentifier");
        Property catalogProp =
                _OntModel.getProperty(_nsName + "#" + element);

        if (relationRes == null) {
            result =
                    "";
            return result;
        } else {



            StmtIterator resourceStmtIt =
                    relationRes.listProperties(resourceProp);
            if (!resourceStmtIt.hasNext()) {
                result =
                        "";
                return result;
            } else {
                while (resourceStmtIt.hasNext()) {
                    Statement resourceStmt =
                            resourceStmtIt.nextStatement();
                    Resource resourceRes =
                            resourceStmt.getResource();
                    StmtIterator identifierIt =
                            resourceRes.listProperties(identifierProp);
                    if (!identifierIt.hasNext()) {
                        result =
                                "";
                        return result;
                    } else {

                        Statement stmtIdentifier =
                                identifierIt.nextStatement();
                        Resource identRes =
                                stmtIdentifier.getResource();

                        StmtIterator catalogIt =
                                identRes.listProperties(catalogProp);

                        if (!catalogIt.hasNext()) {
                            result =
                                    "";
                            return result;
                        } else {
                            while (catalogIt.hasNext()) {
                                Statement stmtCatalog =
                                        catalogIt.nextStatement();
                                result =
                                        stmtCatalog.getString();
                            }
                        }

                    }
                }
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object annotation description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMRelationResourceElement(String loId,
            String language, String element) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasRelation");
        Property dateProp =
                _OntModel.getProperty(_nsName + "#relatedResource");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#" + element);
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            //result.clear();
            result.add("");
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(annotationProp);
            if (!durationStmtIt.hasNext()) {
                //result.clear();
                result.add("");
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator dateStmtIt =
                        durRes.listProperties(dateProp);
                if (!dateStmtIt.hasNext()) {
                    //result.clear();
                    result.add("");
                    return result;
                } else {
                    while (dateStmtIt.hasNext()) {
                        Statement dateStmt =
                                dateStmtIt.nextStatement();
                        Resource dateRes =
                                dateStmt.getResource();
                        StmtIterator descriptionsStmtIt =
                                dateRes.listProperties(descrProp);
                        if (!descriptionsStmtIt.hasNext()) {
                            //result.clear();
                            result.add("");
                            return result;
                        } else {
                            if (language.compareTo("") == 0) {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement descrStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            descrStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itChar.hasNext()) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }

                                }
                            } else {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement titleStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            titleStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itLang =
                                                singleLSInst.listProperties(inLanguageProp);
                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itLang.hasNext()) {
                                            Statement stmtLang =
                                                    itLang.nextStatement();
                                            String languageS =
                                                    stmtLang.getString();
                                            if ((languageS.compareTo(language) ==
                                                    0) ||
                                                    (language.compareTo("") == 0)) {
                                                Statement stmtChar =
                                                        itChar.nextStatement();
                                                String charS =
                                                        stmtChar.getString();
                                                result.add(charS);
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object annotation description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of <CODE>java.lang.String</CODE> that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMRelationResourceElement(String loId,
            String language, String element, String relationId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource relationRes =
                _OntModel.getResource(relationId);


        Property dateProp =
                _OntModel.getProperty(_nsName + "#relatedResource");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#" + element);
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (relationRes == null) {
            //result.clear();
            result.add("");
            return result;
        } else {



            StmtIterator dateStmtIt =
                    relationRes.listProperties(dateProp);
            if (!dateStmtIt.hasNext()) {
                //result.clear();
                result.add("");
                return result;
            } else {
                while (dateStmtIt.hasNext()) {
                    Statement dateStmt =
                            dateStmtIt.nextStatement();
                    Resource dateRes =
                            dateStmt.getResource();
                    StmtIterator descriptionsStmtIt =
                            dateRes.listProperties(descrProp);
                    if (!descriptionsStmtIt.hasNext()) {
                        //result.clear();
                        result.add("");
                        return result;
                    } else {
                        if (language.compareTo("") == 0) {
                            while (descriptionsStmtIt.hasNext()) {
                                Statement descrStmt =
                                        descriptionsStmtIt.nextStatement();
                                Resource lsRes =
                                        descrStmt.getResource();
                                StmtIterator singleStmtIt =
                                        lsRes.listProperties(singleLSProp);
                                while (singleStmtIt.hasNext()) {
                                    Statement singleLSStmt =
                                            singleStmtIt.nextStatement();
                                    Resource singleLSRes =
                                            singleLSStmt.getResource();

                                    Individual singleLSInst =
                                            _OntModel.getIndividual(singleLSRes.getURI());

                                    StmtIterator itChar =
                                            singleLSInst.listProperties(hasValueProp);

                                    while (itChar.hasNext()) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        } else {
                            while (descriptionsStmtIt.hasNext()) {
                                Statement titleStmt =
                                        descriptionsStmtIt.nextStatement();
                                Resource lsRes =
                                        titleStmt.getResource();
                                StmtIterator singleStmtIt =
                                        lsRes.listProperties(singleLSProp);
                                while (singleStmtIt.hasNext()) {
                                    Statement singleLSStmt =
                                            singleStmtIt.nextStatement();
                                    Resource singleLSRes =
                                            singleLSStmt.getResource();

                                    Individual singleLSInst =
                                            _OntModel.getIndividual(singleLSRes.getURI());

                                    StmtIterator itLang =
                                            singleLSInst.listProperties(inLanguageProp);
                                    StmtIterator itChar =
                                            singleLSInst.listProperties(hasValueProp);

                                    while (itLang.hasNext()) {
                                        Statement stmtLang =
                                                itLang.nextStatement();
                                        String languageS =
                                                stmtLang.getString();
                                        if ((languageS.compareTo(language) == 0) ||
                                                (language.compareTo("") == 0)) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }

                                }
                            }
                        }
                    }
                }

            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object annotation
     * entity email
     * <p>
     * @param loId the Learning Object identifier.
     * @return a String that contains the annotation
     * entity email value of the learning object specified.
     */
    public String getLOMAnnotationEntityEmail(String loId) {
        return this.getLOMAnnotationEntityElement(loId, "hasEmail");
    }

    /**
     *
     * This operation returns the learning object annotation
     * entity email from a specific instance
     * <p>
     * @param loId the Learning Object identifier.
     * @param annotationId the annotaion identifier instance
     * @return a String that contains the annotation
     * entity email value of the learning object specified.
     */
    public String getLOMAnnotationEntityEmail(String loId, String annotationId) {
        return this.getLOMAnnotationEntityElement(loId, "hasEmail", annotationId);
    }

    /**
     *
     * This operation returns the learning object annotation
     * entity name 
     * <p>
     * @param loId the Learning Object identifier.
     * @return a String that contains the annotation
     * entity name value of the learning object specified.
     */
    public String getLOMAnnotationEntityName(String loId) {
        return this.getLOMAnnotationEntityElement(loId, "hasName");
    }

    /**
     *
     * This operation returns the learning object annotation
     * entity name from a specific instance
     * <p>
     * @param loId the Learning Object identifier.
     * @param annotationId the annotaion identifier instance
     * @return a String that contains the annotation
     * entity name value of the learning object specified.
     */
    public String getLOMAnnotationEntityName(String loId, String annotationId) {
        return this.getLOMAnnotationEntityElement(loId, "hasName", annotationId);
    }

    /**
     *
     * This operation returns the learning object annotation
     * entity organization
     * <p>
     * @param loId the Learning Object identifier.
     * @return a String that contains the annotation
     * entity organization value of the learning object specified.
     */
    public String getLOMAnnotationEntityOrganization(String loId) {
        return this.getLOMAnnotationEntityElement(loId, "hasOrganization");
    }

    /**
     *
     * This operation returns the learning object annotation
     * entity organization from a specific instance
     * <p>
     * @param loId the Learning Object identifier.
     * @param annotationId the annotaion identifier instance
     * @return a String that contains the annotation
     * entity organization value of the learning object specified.
     */
    public String getLOMAnnotationEntityOrganization(String loId,
            String annotationId) {
        return this.getLOMAnnotationEntityElement(loId, "hasOrganization",
                annotationId);
    }

    /**
     *
     * This operation returns the learning object annotation
     * entity fname
     * <p>
     * @param loId the Learning Object identifier.
     * @return a String that contains the annotation
     * entity fname value of the learning object specified.
     */
    public String getLOMAnnotationEntityFname(String loId) {
        return this.getLOMAnnotationEntityElement(loId, "hasFName");
    }

    /**
     *
     * This operation returns the learning object annotation
     * entity fname from a specific instance
     * <p>
     * @param loId the Learning Object identifier.
     * @param annotationId the annotaion identifier instance
     * @return a String that contains the annotation
     * entity fname value of the learning object specified.
     */
    public String getLOMAnnotationEntityFname(String loId, String annotationId) {
        return this.getLOMAnnotationEntityElement(loId, "hasFName", annotationId);
    }

    /**
     * This method return the required annotation element indicated as param
     * @param loId the learning object identifier
     * @param element the element to gets
     * @return String with the annotation element required
     */
    public String getLOMAnnotationEntityElement(String loId, String element) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasAnnotation");
        Property entityProp =
                _OntModel.getProperty(_nsName + "#annotationEntity");
        Property emailProp =
                _OntModel.getProperty(_nsName + "#" + element);

        String emailVal =
                "";

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator annotaionIt =
                    lo.listProperties(annotationProp);

            if (!annotaionIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtAnnotation =
                        annotaionIt.nextStatement();
                Resource annotationRes =
                        stmtAnnotation.getResource();

                StmtIterator entityIt =
                        annotationRes.listProperties(entityProp);


                if (!entityIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtEntity =
                            entityIt.nextStatement();
                    Resource entityRes =
                            stmtEntity.getResource();

                    StmtIterator emailIt =
                            entityRes.listProperties(emailProp);

                    if (!emailIt.hasNext()) {
                        result =
                                "";
                        return result;
                    } else {
                        Statement stmtDurVal =
                                emailIt.nextStatement();
                        emailVal =
                                stmtDurVal.getString();
                    }

                    result =
                            emailVal;
                }

            }
        }

        return result;
    }

    /**
     * Gets the element indicated as param from one learning object, from annotation category
     * @param loId the learning object identifier
     * @param element the element to gets
     * @param annotationId the annotatio identifier instance
     * @return the annotation entity element required
     */
    public String getLOMAnnotationEntityElement(String loId, String element,
            String annotationId) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource annotationRes =
                _OntModel.getResource(annotationId);


        Property entityProp =
                _OntModel.getProperty(_nsName + "#annotationEntity");
        Property emailProp =
                _OntModel.getProperty(_nsName + "#" + element);

        String emailVal =
                "";

        if (annotationRes == null) {
            result =
                    "";
            return result;
        } else {



            StmtIterator entityIt =
                    annotationRes.listProperties(entityProp);


            if (!entityIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtEntity =
                        entityIt.nextStatement();
                Resource entityRes =
                        stmtEntity.getResource();

                StmtIterator emailIt =
                        entityRes.listProperties(emailProp);

                if (!emailIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {
                    Statement stmtDurVal =
                            emailIt.nextStatement();
                    emailVal =
                            stmtDurVal.getString();
                }

                result =
                        emailVal;
            }

        }

        return result;
    }

    /**
     *
     * This operation returns the learning object 
     * metadata contributing entity email.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the metadata
     * contributing entity email value of the learning object specified.
     */
    public String getLOMMetadataContributingEntityEmail(String loId) {
        return this.getLOMMetadataContributingEntityElement(loId, "hasEmail");
    }

    /**
     *
     * This operation returns the learning object 
     * metadata contributing entity name.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the metadata
     * contributing entity name value of the learning object specified.
     */
    public String getLOMMetadataContributingEntityName(String loId) {
        return this.getLOMMetadataContributingEntityElement(loId, "hasName");
    }

    /**
     *
     * This operation returns the learning object 
     * metadata contributing entity organization.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the metadata
     * contributing entity organization value of the learning object specified.
     */
    public String getLOMMetadataContributingEntityOrganization(String loId) {
        return this.getLOMMetadataContributingEntityElement(loId,
                "hasOrganization");
    }

    /**
     *
     * This operation returns the learning object 
     * metadata contributing entity fname.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the metadata
     * contributing entity fname value of the learning object specified.
     */
    public String getLOMMetadataContributingEntityFname(String loId) {
        return this.getLOMMetadataContributingEntityElement(loId, "hasFName");
    }

    /**
     * This method gets the required contributing entity element from one learning
     * object instance
     * @param loId the learning object identifier
     * @param element the element to gets
     * @return the required metadata element
     */
    public String getLOMMetadataContributingEntityElement(String loId,
            String element) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#metadataHasContribution");
        Property entityProp =
                _OntModel.getProperty(_nsName + "#contributingEntity");
        Property emailProp =
                _OntModel.getProperty(_nsName + "#" + element);

        String emailVal =
                "";

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator annotaionIt =
                    lo.listProperties(annotationProp);

            if (!annotaionIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtAnnotation =
                        annotaionIt.nextStatement();
                Resource annotationRes =
                        stmtAnnotation.getResource();

                StmtIterator entityIt =
                        annotationRes.listProperties(entityProp);


                if (!entityIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtEntity =
                            entityIt.nextStatement();
                    Resource entityRes =
                            stmtEntity.getResource();

                    StmtIterator emailIt =
                            entityRes.listProperties(emailProp);

                    if (!emailIt.hasNext()) {
                        result =
                                "";
                        return result;
                    } else {
                        Statement stmtDurVal =
                                emailIt.nextStatement();
                        emailVal =
                                stmtDurVal.getString();
                    }

                    result =
                            emailVal;
                }

            }
        }

        return result;
    }

    /**
     *
     * This operation returns the learning object 
     * life cycle contributing entity email.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the life cycle
     * contributing entty email value of the learning object specified.
     */
    public String getLOMLifeCycleContributingEntityEmail(String loId) {
        return this.getLOMMetadataContributingEntityElement(loId, "hasEmail");
    }

    /**
     *
     * This operation returns the learning object 
     * life cycle contributing entity name.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the life cycle
     * vontributing entity name value of the learning object specified.
     */
    public String getLOMLifeCycleContributingEntityName(String loId) {
        return this.getLOMLifeCycleContributingEntityElement(loId, "hasName");
    }

    /**
     *
     * This operation returns the learning object 
     * life cycle contributing entity organization.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the life cycle
     * contributing entity organization value of the learning object specified.
     */
    public String getLOMLifeCycleContributingEntityOrganization(String loId) {
        return this.getLOMLifeCycleContributingEntityElement(loId,
                "hasOrganization");
    }

    /**
     *
     * This operation returns the learning object 
     * life cycle contributing entity fname.
     * <p>
     * @param loId the Learning Object identifier.
     * @return String that contains the life cycle
     * contributing entity fname value of the learning object specified.
     */
    public String getLOMLifeCycleContributingEntityFname(String loId) {
        return this.getLOMLifeCycleContributingEntityElement(loId, "hasFName");
    }

    /**
     * This method gets the required contributing entity element
     * @param loId the learning object idnetifier
     * @param element the element to gets
     * @return the required element
     */
    public String getLOMLifeCycleContributingEntityElement(String loId,
            String element) {

        String result =
                new String();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasContribution");
        Property entityProp =
                _OntModel.getProperty(_nsName + "#contributingEntity");
        Property emailProp =
                _OntModel.getProperty(_nsName + "#" + element);

        String emailVal =
                "";

        if (lo == null) {
            result =
                    "";
            return result;
        } else {

            StmtIterator annotaionIt =
                    lo.listProperties(annotationProp);

            if (!annotaionIt.hasNext()) {
                result =
                        "";
                return result;
            } else {

                Statement stmtAnnotation =
                        annotaionIt.nextStatement();
                Resource annotationRes =
                        stmtAnnotation.getResource();

                StmtIterator entityIt =
                        annotationRes.listProperties(entityProp);


                if (!entityIt.hasNext()) {
                    result =
                            "";
                    return result;
                } else {

                    Statement stmtEntity =
                            entityIt.nextStatement();
                    Resource entityRes =
                            stmtEntity.getResource();

                    StmtIterator emailIt =
                            entityRes.listProperties(emailProp);

                    if (!emailIt.hasNext()) {
                        result =
                                "";
                        return result;
                    } else {
                        Statement stmtDurVal =
                                emailIt.nextStatement();
                        emailVal =
                                stmtDurVal.getString();
                    }

                    result =
                            emailVal;
                }

            }
        }

        return result;
    }

    /**
     * This operation returns a learning object annotation date value
     * <p>
     * @param loId the Learning Object identifier.    
     * @return a Set of String that contains the
     * annotation date value of the learning object according to the language.
     */
    public Set<String> getLOMAnnotationDateValue(String loId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasAnnotation");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#annotationDate");
        Property valueProp =
                _OntModel.getProperty(_nsName +
                "#hasDateTimeValue");


        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(annotationProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator descriptionsStmtIt =
                        durRes.listProperties(descrProp);
                if (!descriptionsStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {

                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(valueProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            String value =
                                    singleLSStmt.getString();
                            result.add(value);

                        }

                    }

                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object annotation date value
     * from a specific instance
     * <p>
     * @param loId the Learning Object identifier.    
     * @return a Set of String that contains the
     * annotation date value of the learning object according to the language.
     */
    public Set<String> getLOMAnnotationDateValue(String loId,
            String annotationId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource annotationRes =
                _OntModel.getResource(annotationId);


        Property descrProp =
                _OntModel.getProperty(_nsName + "#annotationDate");
        Property valueProp =
                _OntModel.getProperty(_nsName +
                "#hasDateTimeValue");


        if (annotationRes == null) {
            result.clear();
            return result;
        } else {


            StmtIterator descriptionsStmtIt =
                    annotationRes.listProperties(descrProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                while (descriptionsStmtIt.hasNext()) {
                    Statement descrStmt =
                            descriptionsStmtIt.nextStatement();
                    Resource lsRes =
                            descrStmt.getResource();
                    StmtIterator singleStmtIt =
                            lsRes.listProperties(valueProp);
                    while (singleStmtIt.hasNext()) {
                        Statement singleLSStmt =
                                singleStmtIt.nextStatement();
                        String value =
                                singleLSStmt.getString();
                        result.add(value);

                    }

                }


            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object 
     * metadata contribution date value
     * <p>
     * @param loId the Learning Object identifier.
     * @return a SEt of String that contains the metadata
     * contribution date values of the learning object specified.
     */
    public Set<String> getLOMMetadataContributionDateValue(String loId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#metadataHasContribution");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#contributionDateTime");
        Property valueProp =
                _OntModel.getProperty(_nsName +
                "#hasDateTimeValue");


        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(annotationProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator descriptionsStmtIt =
                        durRes.listProperties(descrProp);
                if (!descriptionsStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {

                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(valueProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            String value =
                                    singleLSStmt.getString();
                            result.add(value);

                        }

                    }

                }
            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object
     * contribution date value from the 
     * metadata record identifier.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of String that contains the
     * contribution date value of the learning object specified.
     */
    public Set<String> getLOMLifeCycleContributionDateValue(String loId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasContribution");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#contributionDateTime");
        Property valueProp =
                _OntModel.getProperty(_nsName +
                "#hasDateTimeValue");


        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(annotationProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator descriptionsStmtIt =
                        durRes.listProperties(descrProp);
                if (!descriptionsStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {

                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(valueProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            String value =
                                    singleLSStmt.getString();
                            result.add(value);

                        }

                    }

                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object annotation description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of String that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMAnnotationDateDescription(String loId,
            String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasAnnotation");
        Property dateProp =
                _OntModel.getProperty(_nsName + "#annotationDate");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDateTimeDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(annotationProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator dateStmtIt =
                        durRes.listProperties(dateProp);
                if (!dateStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    while (dateStmtIt.hasNext()) {
                        Statement dateStmt =
                                dateStmtIt.nextStatement();
                        Resource dateRes =
                                dateStmt.getResource();
                        StmtIterator descriptionsStmtIt =
                                dateRes.listProperties(descrProp);
                        if (!descriptionsStmtIt.hasNext()) {
                            result.clear();
                            return result;
                        } else {
                            if (language.compareTo("") == 0) {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement descrStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            descrStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itChar.hasNext()) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }

                                }
                            } else {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement titleStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            titleStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itLang =
                                                singleLSInst.listProperties(inLanguageProp);
                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itLang.hasNext()) {
                                            Statement stmtLang =
                                                    itLang.nextStatement();
                                            String languageS =
                                                    stmtLang.getString();
                                            if ((languageS.compareTo(language) ==
                                                    0) ||
                                                    (language.compareTo("") == 0)) {
                                                Statement stmtChar =
                                                        itChar.nextStatement();
                                                String charS =
                                                        stmtChar.getString();
                                                result.add(charS);
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object annotation description
     * from a specific instance
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of String that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMAnnotationDateDescription(String loId,
            String language, String annotaionId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource annotationRes =
                _OntModel.getResource(annotaionId);


        Property dateProp =
                _OntModel.getProperty(_nsName + "#annotationDate");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDateTimeDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (annotationRes == null) {
            result.clear();
            return result;
        } else {

            StmtIterator dateStmtIt =
                    annotationRes.listProperties(dateProp);
            if (!dateStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                while (dateStmtIt.hasNext()) {
                    Statement dateStmt =
                            dateStmtIt.nextStatement();
                    Resource dateRes =
                            dateStmt.getResource();
                    StmtIterator descriptionsStmtIt =
                            dateRes.listProperties(descrProp);
                    if (!descriptionsStmtIt.hasNext()) {
                        result.clear();
                        return result;
                    } else {
                        if (language.compareTo("") == 0) {
                            while (descriptionsStmtIt.hasNext()) {
                                Statement descrStmt =
                                        descriptionsStmtIt.nextStatement();
                                Resource lsRes =
                                        descrStmt.getResource();
                                StmtIterator singleStmtIt =
                                        lsRes.listProperties(singleLSProp);
                                while (singleStmtIt.hasNext()) {
                                    Statement singleLSStmt =
                                            singleStmtIt.nextStatement();
                                    Resource singleLSRes =
                                            singleLSStmt.getResource();

                                    Individual singleLSInst =
                                            _OntModel.getIndividual(singleLSRes.getURI());

                                    StmtIterator itChar =
                                            singleLSInst.listProperties(hasValueProp);

                                    while (itChar.hasNext()) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        } else {
                            while (descriptionsStmtIt.hasNext()) {
                                Statement titleStmt =
                                        descriptionsStmtIt.nextStatement();
                                Resource lsRes =
                                        titleStmt.getResource();
                                StmtIterator singleStmtIt =
                                        lsRes.listProperties(singleLSProp);
                                while (singleStmtIt.hasNext()) {
                                    Statement singleLSStmt =
                                            singleStmtIt.nextStatement();
                                    Resource singleLSRes =
                                            singleLSStmt.getResource();

                                    Individual singleLSInst =
                                            _OntModel.getIndividual(singleLSRes.getURI());

                                    StmtIterator itLang =
                                            singleLSInst.listProperties(inLanguageProp);
                                    StmtIterator itChar =
                                            singleLSInst.listProperties(hasValueProp);

                                    while (itLang.hasNext()) {
                                        Statement stmtLang =
                                                itLang.nextStatement();
                                        String languageS =
                                                stmtLang.getString();
                                        if ((languageS.compareTo(language) == 0) ||
                                                (language.compareTo("") == 0)) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }

                                }
                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object 
     * metadata contribution date description.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of String that contains the metadata
     * contribution date description values of the learning object specified.
     */
    public Set<String> getLOMMetadataContributionDateDescription(String loId,
            String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#metadataHasContribution");
        Property dateProp =
                _OntModel.getProperty(_nsName + "#contributionDateTime");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDateTimeDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(annotationProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator dateStmtIt =
                        durRes.listProperties(dateProp);
                if (!dateStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    while (dateStmtIt.hasNext()) {
                        Statement dateStmt =
                                dateStmtIt.nextStatement();
                        Resource dateRes =
                                dateStmt.getResource();
                        StmtIterator descriptionsStmtIt =
                                dateRes.listProperties(descrProp);
                        if (!descriptionsStmtIt.hasNext()) {
                            result.clear();
                            return result;
                        } else {
                            if (language.compareTo("") == 0) {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement descrStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            descrStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itChar.hasNext()) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }

                                }
                            } else {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement titleStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            titleStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itLang =
                                                singleLSInst.listProperties(inLanguageProp);
                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itLang.hasNext()) {
                                            Statement stmtLang =
                                                    itLang.nextStatement();
                                            String languageS =
                                                    stmtLang.getString();
                                            if ((languageS.compareTo(language) ==
                                                    0) ||
                                                    (language.compareTo("") == 0)) {
                                                Statement stmtChar =
                                                        itChar.nextStatement();
                                                String charS =
                                                        stmtChar.getString();
                                                result.add(charS);
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object
     * contribution date description from the 
     * metadata record identifier.
     * <p>
     * @param loId the Learning Object identifier.
     * @return a Set of String that contains the
     * contribution date description of the learning object specified.
     */
    public Set<String> getLOMLifeCycleContributionDateDescription(String loId,
            String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasContribution");
        Property dateProp =
                _OntModel.getProperty(_nsName + "#contributionDateTime");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#hasDateTimeDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(annotationProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator dateStmtIt =
                        durRes.listProperties(dateProp);
                if (!dateStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    while (dateStmtIt.hasNext()) {
                        Statement dateStmt =
                                dateStmtIt.nextStatement();
                        Resource dateRes =
                                dateStmt.getResource();
                        StmtIterator descriptionsStmtIt =
                                dateRes.listProperties(descrProp);
                        if (!descriptionsStmtIt.hasNext()) {
                            result.clear();
                            return result;
                        } else {
                            if (language.compareTo("") == 0) {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement descrStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            descrStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itChar.hasNext()) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }

                                }
                            } else {
                                while (descriptionsStmtIt.hasNext()) {
                                    Statement titleStmt =
                                            descriptionsStmtIt.nextStatement();
                                    Resource lsRes =
                                            titleStmt.getResource();
                                    StmtIterator singleStmtIt =
                                            lsRes.listProperties(singleLSProp);
                                    while (singleStmtIt.hasNext()) {
                                        Statement singleLSStmt =
                                                singleStmtIt.nextStatement();
                                        Resource singleLSRes =
                                                singleLSStmt.getResource();

                                        Individual singleLSInst =
                                                _OntModel.getIndividual(singleLSRes.getURI());

                                        StmtIterator itLang =
                                                singleLSInst.listProperties(inLanguageProp);
                                        StmtIterator itChar =
                                                singleLSInst.listProperties(hasValueProp);

                                        while (itLang.hasNext()) {
                                            Statement stmtLang =
                                                    itLang.nextStatement();
                                            String languageS =
                                                    stmtLang.getString();
                                            if ((languageS.compareTo(language) ==
                                                    0) ||
                                                    (language.compareTo("") == 0)) {
                                                Statement stmtChar =
                                                        itChar.nextStatement();
                                                String charS =
                                                        stmtChar.getString();
                                                result.add(charS);
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object annotation description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of String that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMAnnotationDescription(String loId, String language) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual lo =
                _OntModel.getIndividual(loId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasAnnotation");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#annotationDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (lo == null) {
            result.clear();
            return result;
        } else {

            StmtIterator durationStmtIt =
                    lo.listProperties(annotationProp);
            if (!durationStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {

                Statement durationStmt =
                        durationStmtIt.nextStatement();
                Resource durRes =
                        durationStmt.getResource();

                StmtIterator descriptionsStmtIt =
                        durRes.listProperties(descrProp);
                if (!descriptionsStmtIt.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    if (language.compareTo("") == 0) {
                        while (descriptionsStmtIt.hasNext()) {
                            Statement descrStmt =
                                    descriptionsStmtIt.nextStatement();
                            Resource lsRes =
                                    descrStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itChar.hasNext()) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    } else {
                        while (descriptionsStmtIt.hasNext()) {
                            Statement titleStmt =
                                    descriptionsStmtIt.nextStatement();
                            Resource lsRes =
                                    titleStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itLang =
                                        singleLSInst.listProperties(inLanguageProp);
                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itLang.hasNext()) {
                                    Statement stmtLang =
                                            itLang.nextStatement();
                                    String languageS =
                                            stmtLang.getString();
                                    if ((languageS.compareTo(language) == 0) ||
                                            (language.compareTo("") == 0)) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /** This operation returns a learning object annotation description
     * from a specific instance
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of String that contains the
     * description of the learning object according to the language.
     */
    public Set<String> getLOMAnnotationDescription(String loId, String language,
            String annotationId) {
        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource annotationRes =
                _OntModel.getResource(annotationId);

        Property annotationProp =
                _OntModel.getProperty(_nsName + "#hasAnnotation");
        Property descrProp =
                _OntModel.getProperty(_nsName + "#annotationDescription");
        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");

        if (annotationRes == null) {
            result.clear();
            return result;
        } else {


            StmtIterator descriptionsStmtIt =
                    annotationRes.listProperties(descrProp);
            if (!descriptionsStmtIt.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement descrStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (descriptionsStmtIt.hasNext()) {
                        Statement titleStmt =
                                descriptionsStmtIt.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }
                }

            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object classification
     * purpose 
     * <p>
     * @param loId the Learning Object identifier.     
     * @return a String that contains the classification
     * purpose value of the learning object specified.
     */
    public String getLOMClassificationPurpose(String loId) {

        String purpose =
                "";
        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual loInstance =
                _OntModel.getIndividual(loId);


        Property hasElement =
                _OntModel.getProperty(_nsName + "#hasClassification");
        StmtIterator lsInstances =
                loInstance.listProperties(hasElement);
        //for each element
        while (lsInstances.hasNext()) {
            Statement lsResource =
                    lsInstances.nextStatement();
            Resource res =
                    lsResource.getResource();
            Property claKey =
                    _OntModel.getProperty(_nsName + "#classificationPurpose");
            StmtIterator ctpInstances =
                    res.listProperties(claKey);
            while (ctpInstances.hasNext()) {
                Statement ctpInstance =
                        ctpInstances.nextStatement();
                purpose =
                        ctpInstance.getString();

            }
        }

        return purpose;
    }

    /**
     *
     * This operation returns the learning object classification
     * purpose from a specific instance
     * <p>
     * @param loId the Learning Object identifier.
     * @param classificationId the annotaion identifier instance
     * @return a String that contains the classification
     * purpose value of the learning object specified.
     */
    public String getLOMClassificationPurpose(String loId,
            String classificationId) {

        String purpose =
                "";
        /*
         * Check if a instance about the LOReference exists,
         * and then search the keywords.
         */

        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource clasRes =
                _OntModel.getResource(classificationId);



        Property claKey =
                _OntModel.getProperty(_nsName + "#classificationPurpose");
        StmtIterator ctpInstances =
                clasRes.listProperties(claKey);
        while (ctpInstances.hasNext()) {
            Statement ctpInstance =
                    ctpInstances.nextStatement();
            purpose =
                    ctpInstance.getString();

        }


        return purpose;
    }

    /**
     * This operation returns a learning object classification taxon path source.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of String that contains the classification
     * taxon path source of the learning object according to the language.
     */
    public Set<String> getLOMClassificationTaxonPathsource(String loId,
            String language) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual loInstance =
                _OntModel.getIndividual(loId);

        ObjectProperty hasClasification =
                _OntModel.getObjectProperty(_nsName + "#hasClassification");
        NodeIterator clasInstances =
                loInstance.listPropertyValues(hasClasification);

        while (clasInstances.hasNext()) {

            Resource clasResource =
                    (Resource) clasInstances.next();
            ObjectProperty claKey =
                    _OntModel.getObjectProperty(_nsName +
                    "#classificationTaxonPath");
            StmtIterator ctpInstances =
                    clasResource.listProperties(claKey);

            while (ctpInstances.hasNext()) {
                Statement ctpInstance =
                        ctpInstances.nextStatement();
                Resource cptResource =
                        ctpInstance.getResource();
                ObjectProperty claTaxP =
                        _OntModel.getObjectProperty(_nsName +
                        "#classificationSource");
                StmtIterator sourceLSInstances =
                        cptResource.listProperties(claTaxP);


                Property singleLSProp =
                        _OntModel.getProperty(_nsName +
                        "#includesSingleLangString");
                Property hasValueProp =
                        _OntModel.getProperty(_nsName + "#hasValue");
                Property inLanguageProp =
                        _OntModel.getProperty(_nsName +
                        "#inLanguage");


                if (!sourceLSInstances.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    if (language.compareTo("") == 0) {
                        while (sourceLSInstances.hasNext()) {
                            Statement descrStmt =
                                    sourceLSInstances.nextStatement();
                            Resource lsRes =
                                    descrStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itChar.hasNext()) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    } else {
                        while (sourceLSInstances.hasNext()) {
                            Statement titleStmt =
                                    sourceLSInstances.nextStatement();
                            Resource lsRes =
                                    titleStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itLang =
                                        singleLSInst.listProperties(inLanguageProp);
                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itLang.hasNext()) {
                                    Statement stmtLang =
                                            itLang.nextStatement();
                                    String languageS =
                                            stmtLang.getString();
                                    if ((languageS.compareTo(language) == 0) ||
                                            (language.compareTo("") == 0)) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return result;
    }

    /**
     * This operation returns a learning object classification taxon path source
     * from a specific classification instance
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @param classificationId the classification identifier instance
     * @return a Set of String that contains the classification
     * taxon path source of the learning object according to the language.
     */
    public Set<String> getLOMClassificationTaxonPathsource(String loId,
            String language, String classificationId) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource clasRes =
                _OntModel.getResource(classificationId);



        ObjectProperty claKey =
                _OntModel.getObjectProperty(_nsName + "#classificationTaxonPath");
        StmtIterator ctpInstances =
                clasRes.listProperties(claKey);

        while (ctpInstances.hasNext()) {
            Statement ctpInstance =
                    ctpInstances.nextStatement();
            Resource cptResource =
                    ctpInstance.getResource();
            ObjectProperty claTaxP =
                    _OntModel.getObjectProperty(_nsName +
                    "#classificationSource");
            StmtIterator sourceLSInstances =
                    cptResource.listProperties(claTaxP);


            Property singleLSProp =
                    _OntModel.getProperty(_nsName +
                    "#includesSingleLangString");
            Property hasValueProp =
                    _OntModel.getProperty(_nsName + "#hasValue");
            Property inLanguageProp =
                    _OntModel.getProperty(_nsName +
                    "#inLanguage");


            if (!sourceLSInstances.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (sourceLSInstances.hasNext()) {
                        Statement descrStmt =
                                sourceLSInstances.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (sourceLSInstances.hasNext()) {
                        Statement titleStmt =
                                sourceLSInstances.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    }

                }
            }
        }
        return result;
    }

    /**
     *
     * This operation returns the learning object classification id
     * 
     * <p>
     * @param loId the Learning Object identifier.
     * @return a String that contains the classification
     * taxon id value of the learning object specified.
     */
    public Set<String> getLOMClassificationTaxonPathTaxonId(String loId) {

        Set<String> taxonId =
                new TreeSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             









        if (_OntModel == null) {
            this._OntModel =
                    this.getOntologyModel();
        }

        Individual loInstance =
                _OntModel.getIndividual(loId);

        ObjectProperty hasClasification =
                _OntModel.getObjectProperty(_nsName + "#hasClassification");
        ObjectProperty claKey =
                _OntModel.getObjectProperty(_nsName +
                "#classificationTaxonPath");
        NodeIterator clasInstances =
                loInstance.listPropertyValues(hasClasification);



        while (clasInstances.hasNext()) {

            Resource clasRes =
                    (Resource) clasInstances.next();


            StmtIterator ctpInstances =
                    clasRes.listProperties(claKey);


            while (ctpInstances.hasNext()) {
                Statement ctpInstance =
                        ctpInstances.nextStatement();
                Resource cptResource =
                        ctpInstance.getResource();

                Property claTaxP =
                        _OntModel.getProperty(_nsName +
                        "#classificationTaxon");
                StmtIterator claTaxProperties =
                        cptResource.listProperties(claTaxP);


                while (claTaxProperties.hasNext()) {
                    //taxon entry
                    Statement claTax =
                            claTaxProperties.nextStatement();
                    Resource claTaxResource =
                            claTax.getResource();


                    Property taxEntry =
                            _OntModel.getProperty(_nsName + "#taxonId");
                    //instace of langStringSingle 
                    Individual slsIndividual =
                            _OntModel.getIndividual(_nsName + "#" +
                            claTaxResource.getLocalName());

//                RDFNode slsValues = slsIndividual.getPropertyValue(taxEntry);
//                String value = slsValues.toString();
//                int car = value.indexOf("^");

//                taxonId = value.substring(0, car);
                    StmtIterator slsIt =
                            slsIndividual.listProperties(taxEntry);


                    if (!slsIt.hasNext()) {
                        taxonId.clear();

                    } else {

                        Statement stmtMetadataLang =
                                slsIt.nextStatement();
                        taxonId.add(stmtMetadataLang.getResource().
                                getLocalName().toString());
                    }

                }


            }
        }
        return taxonId;
    }

    /**
     *
     * This operation returns the learning object classification id
     * from a specific instance
     * <p>
     * @param loId the Learning Object identifier.
     * @param classificationId the classification identifier instance
     * @return a String that contains the classification
     * taxon id value of the learning object specified.
     */
    public Set<String> getLOMClassificationTaxonPathTaxonId(String loId,
            String classificationId) {

        Set<String> taxonId =
                new TreeSet<String>();

        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             









        if (_OntModel == null) {
            this._OntModel =
                    this.getOntologyModel();
        }

        Resource clasRes =
                _OntModel.getResource(classificationId);



        ObjectProperty claKey =
                _OntModel.getObjectProperty(_nsName +
                "#classificationTaxonPath");
        StmtIterator ctpInstances =
                clasRes.listProperties(claKey);


        while (ctpInstances.hasNext()) {
            Statement ctpInstance =
                    ctpInstances.nextStatement();
            Resource cptResource =
                    ctpInstance.getResource();

            Property claTaxP =
                    _OntModel.getProperty(_nsName +
                    "#classificationTaxon");
            StmtIterator claTaxProperties =
                    cptResource.listProperties(claTaxP);


            while (claTaxProperties.hasNext()) {
                //taxon entry
                Statement claTax =
                        claTaxProperties.nextStatement();
                Resource claTaxResource =
                        claTax.getResource();


                Property taxEntry =
                        _OntModel.getProperty(_nsName + "#taxonId");
                //instace of langStringSingle 
                Individual slsIndividual =
                        _OntModel.getIndividual(_nsName + "#" +
                        claTaxResource.getLocalName());

//                RDFNode slsValues = slsIndividual.getPropertyValue(taxEntry);
//                String value = slsValues.toString();
//                int car = value.indexOf("^");

//                taxonId = value.substring(0, car);
                StmtIterator slsIt =
                        slsIndividual.listProperties(taxEntry);


                if (!slsIt.hasNext()) {
                    taxonId.clear();

                } else {

                    while (slsIt.hasNext()) {
                        Statement stmtMetadataLang =
                                slsIt.nextStatement();
                        taxonId.add(stmtMetadataLang.getResource().getLocalName().
                                toString());
                    }
                }

            }

        }
        return taxonId;
    }

    /**
     * This operation returns a learning object classification taxon entry.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of String that contains the classification
     * taxon entry of the learning object according to the language.
     */
    public Set<String> getLOMClassificationTaxonPathTaxonEntry(String loId,
            String language) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual loInstance =
                _OntModel.getIndividual(loId);


        ObjectProperty hasClasification =
                _OntModel.getObjectProperty(_nsName + "#hasClassification");
        NodeIterator clasInstances =
                loInstance.listPropertyValues(hasClasification);

        while (clasInstances.hasNext()) {

            Resource clasResource =
                    (Resource) clasInstances.next();
            ObjectProperty claKey =
                    _OntModel.getObjectProperty(_nsName +
                    "#classificationTaxonPath");
            StmtIterator ctpInstances =
                    clasResource.listProperties(claKey);
            while (ctpInstances.hasNext()) {
                Statement ctpInstance =
                        ctpInstances.nextStatement();
                Resource cptResource =
                        ctpInstance.getResource();
                Property claTaxP =
                        _OntModel.getProperty(_nsName + "#classificationTaxon");
                StmtIterator claTaxProperties =
                        cptResource.listProperties(claTaxP);
                while (claTaxProperties.hasNext()) {
                    //taxon entry
                    Statement claTax =
                            claTaxProperties.nextStatement();
                    Resource claTaxResource =
                            claTax.getResource();
                    ObjectProperty taxEntry =
                            _OntModel.getObjectProperty(_nsName + "#taxonEntry");
                    StmtIterator lsInstances =
                            claTaxResource.listProperties(taxEntry);


                    Property singleLSProp =
                            _OntModel.getProperty(_nsName +
                            "#includesSingleLangString");
                    Property hasValueProp =
                            _OntModel.getProperty(_nsName + "#hasValue");
                    Property inLanguageProp =
                            _OntModel.getProperty(_nsName +
                            "#inLanguage");


                    if (!lsInstances.hasNext()) {
                        result.clear();
                        return result;
                    } else {
                        if (language.compareTo("") == 0) {
                            while (lsInstances.hasNext()) {
                                Statement descrStmt =
                                        lsInstances.nextStatement();
                                Resource lsRes =
                                        descrStmt.getResource();
                                StmtIterator singleStmtIt =
                                        lsRes.listProperties(singleLSProp);
                                while (singleStmtIt.hasNext()) {
                                    Statement singleLSStmt =
                                            singleStmtIt.nextStatement();
                                    Resource singleLSRes =
                                            singleLSStmt.getResource();

                                    Individual singleLSInst =
                                            _OntModel.getIndividual(singleLSRes.getURI());

                                    StmtIterator itChar =
                                            singleLSInst.listProperties(hasValueProp);

                                    while (itChar.hasNext()) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }

                            }
                        } else {
                            while (lsInstances.hasNext()) {
                                Statement titleStmt =
                                        lsInstances.nextStatement();
                                Resource lsRes =
                                        titleStmt.getResource();
                                StmtIterator singleStmtIt =
                                        lsRes.listProperties(singleLSProp);
                                while (singleStmtIt.hasNext()) {
                                    Statement singleLSStmt =
                                            singleStmtIt.nextStatement();
                                    Resource singleLSRes =
                                            singleLSStmt.getResource();

                                    Individual singleLSInst =
                                            _OntModel.getIndividual(singleLSRes.getURI());

                                    StmtIterator itLang =
                                            singleLSInst.listProperties(inLanguageProp);
                                    StmtIterator itChar =
                                            singleLSInst.listProperties(hasValueProp);

                                    while (itLang.hasNext()) {
                                        Statement stmtLang =
                                                itLang.nextStatement();
                                        String languageS =
                                                stmtLang.getString();
                                        if ((languageS.compareTo(language) == 0) ||
                                                (language.compareTo("") == 0)) {
                                            Statement stmtChar =
                                                    itChar.nextStatement();
                                            String charS =
                                                    stmtChar.getString();
                                            result.add(charS);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object classification taxon entry
     * from a specific classification instance
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @param classificationId the classification identifier instance
     * @return a Set of String that contains the classification
     * taxon entry of the learning object according to the language.
     */
    public Set<String> getLOMClassificationTaxonPathTaxonEntry(String loId,
            String language, String classificationId) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource clasRes =
                _OntModel.getResource(classificationId);



        ObjectProperty claKey =
                _OntModel.getObjectProperty(_nsName + "#classificationTaxonPath");
        StmtIterator ctpInstances =
                clasRes.listProperties(claKey);
        while (ctpInstances.hasNext()) {
            Statement ctpInstance =
                    ctpInstances.nextStatement();
            Resource cptResource =
                    ctpInstance.getResource();
            Property claTaxP =
                    _OntModel.getProperty(_nsName + "#classificationTaxon");
            StmtIterator claTaxProperties =
                    cptResource.listProperties(claTaxP);
            while (claTaxProperties.hasNext()) {
                //taxon entry
                Statement claTax =
                        claTaxProperties.nextStatement();
                Resource claTaxResource =
                        claTax.getResource();
                ObjectProperty taxEntry =
                        _OntModel.getObjectProperty(_nsName + "#taxonEntry");
                StmtIterator lsInstances =
                        claTaxResource.listProperties(taxEntry);


                Property singleLSProp =
                        _OntModel.getProperty(_nsName +
                        "#includesSingleLangString");
                Property hasValueProp =
                        _OntModel.getProperty(_nsName + "#hasValue");
                Property inLanguageProp =
                        _OntModel.getProperty(_nsName +
                        "#inLanguage");


                if (!lsInstances.hasNext()) {
                    result.clear();
                    return result;
                } else {
                    if (language.compareTo("") == 0) {
                        while (lsInstances.hasNext()) {
                            Statement descrStmt =
                                    lsInstances.nextStatement();
                            Resource lsRes =
                                    descrStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itChar.hasNext()) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }

                        }
                    } else {
                        while (lsInstances.hasNext()) {
                            Statement titleStmt =
                                    lsInstances.nextStatement();
                            Resource lsRes =
                                    titleStmt.getResource();
                            StmtIterator singleStmtIt =
                                    lsRes.listProperties(singleLSProp);
                            while (singleStmtIt.hasNext()) {
                                Statement singleLSStmt =
                                        singleStmtIt.nextStatement();
                                Resource singleLSRes =
                                        singleLSStmt.getResource();

                                Individual singleLSInst =
                                        _OntModel.getIndividual(singleLSRes.getURI());

                                StmtIterator itLang =
                                        singleLSInst.listProperties(inLanguageProp);
                                StmtIterator itChar =
                                        singleLSInst.listProperties(hasValueProp);

                                while (itLang.hasNext()) {
                                    Statement stmtLang =
                                            itLang.nextStatement();
                                    String languageS =
                                            stmtLang.getString();
                                    if ((languageS.compareTo(language) == 0) ||
                                            (language.compareTo("") == 0)) {
                                        Statement stmtChar =
                                                itChar.nextStatement();
                                        String charS =
                                                stmtChar.getString();
                                        result.add(charS);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object classification description.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of String that contains the classification
     * description of the learning object according to the language.
     */
    public Set<String> getLOMClassificationDescription(String loId,
            String language) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual loInstance =
                _OntModel.getIndividual(loId);


        ObjectProperty hasClasification =
                _OntModel.getObjectProperty(_nsName + "#hasClassification");
        NodeIterator clasInstances =
                loInstance.listPropertyValues(hasClasification);

        while (clasInstances.hasNext()) {

            Resource clasResource =
                    (Resource) clasInstances.next();
            ObjectProperty claKey =
                    _OntModel.getObjectProperty(_nsName + "#taxonDescription");
            StmtIterator lsInstances =
                    clasResource.listProperties(claKey);


            Property singleLSProp =
                    _OntModel.getProperty(_nsName +
                    "#includesSingleLangString");
            Property hasValueProp =
                    _OntModel.getProperty(_nsName + "#hasValue");
            Property inLanguageProp =
                    _OntModel.getProperty(_nsName +
                    "#inLanguage");


            if (!lsInstances.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (lsInstances.hasNext()) {
                        Statement descrStmt =
                                lsInstances.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (lsInstances.hasNext()) {
                        Statement titleStmt =
                                lsInstances.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }
                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object classification description
     * froma specific instance
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @param classificationId the classificatin identifier instance
     * @return a Set of String that contains the classification
     * description of the learning object according to the language.
     */
    public Set<String> getLOMClassificationDescription(String loId,
            String language, String classificationId) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource clasRes =
                _OntModel.getResource(classificationId);



        ObjectProperty claKey =
                _OntModel.getObjectProperty(_nsName + "#taxonDescription");
        StmtIterator lsInstances =
                clasRes.listProperties(claKey);


        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");


        if (!lsInstances.hasNext()) {
            result.clear();
            return result;
        } else {
            if (language.compareTo("") == 0) {
                while (lsInstances.hasNext()) {
                    Statement descrStmt =
                            lsInstances.nextStatement();
                    Resource lsRes =
                            descrStmt.getResource();
                    StmtIterator singleStmtIt =
                            lsRes.listProperties(singleLSProp);
                    while (singleStmtIt.hasNext()) {
                        Statement singleLSStmt =
                                singleStmtIt.nextStatement();
                        Resource singleLSRes =
                                singleLSStmt.getResource();

                        Individual singleLSInst =
                                _OntModel.getIndividual(singleLSRes.getURI());

                        StmtIterator itChar =
                                singleLSInst.listProperties(hasValueProp);

                        while (itChar.hasNext()) {
                            Statement stmtChar =
                                    itChar.nextStatement();
                            String charS =
                                    stmtChar.getString();
                            result.add(charS);
                        }
                    }

                }
            } else {
                while (lsInstances.hasNext()) {
                    Statement titleStmt =
                            lsInstances.nextStatement();
                    Resource lsRes =
                            titleStmt.getResource();
                    StmtIterator singleStmtIt =
                            lsRes.listProperties(singleLSProp);
                    while (singleStmtIt.hasNext()) {
                        Statement singleLSStmt =
                                singleStmtIt.nextStatement();
                        Resource singleLSRes =
                                singleLSStmt.getResource();

                        Individual singleLSInst =
                                _OntModel.getIndividual(singleLSRes.getURI());

                        StmtIterator itLang =
                                singleLSInst.listProperties(inLanguageProp);
                        StmtIterator itChar =
                                singleLSInst.listProperties(hasValueProp);

                        while (itLang.hasNext()) {
                            Statement stmtLang =
                                    itLang.nextStatement();
                            String languageS =
                                    stmtLang.getString();
                            if ((languageS.compareTo(language) == 0) ||
                                    (language.compareTo("") == 0)) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object classification keyword.
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @return a Set of String that contains the classification
     * keyword of the learning object according to the language.
     */
    public Set<String> getLOMClassificationKeyword(String loId, String language) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Individual loInstance =
                _OntModel.getIndividual(loId);

        ObjectProperty hasClasification =
                _OntModel.getObjectProperty(_nsName + "#hasClassification");
        NodeIterator clasInstances =
                loInstance.listPropertyValues(hasClasification);
        while (clasInstances.hasNext()) {
            Resource clasResource =
                    (Resource) clasInstances.next();
            ObjectProperty claKey =
                    _OntModel.getObjectProperty(_nsName +
                    "#classificationKeyword");
            StmtIterator lsInstances =
                    clasResource.listProperties(claKey);



            Property singleLSProp =
                    _OntModel.getProperty(_nsName +
                    "#includesSingleLangString");
            Property hasValueProp =
                    _OntModel.getProperty(_nsName + "#hasValue");
            Property inLanguageProp =
                    _OntModel.getProperty(_nsName +
                    "#inLanguage");


            if (!lsInstances.hasNext()) {
                result.clear();
                return result;
            } else {
                if (language.compareTo("") == 0) {
                    while (lsInstances.hasNext()) {
                        Statement descrStmt =
                                lsInstances.nextStatement();
                        Resource lsRes =
                                descrStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itChar.hasNext()) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }

                    }
                } else {
                    while (lsInstances.hasNext()) {
                        Statement titleStmt =
                                lsInstances.nextStatement();
                        Resource lsRes =
                                titleStmt.getResource();
                        StmtIterator singleStmtIt =
                                lsRes.listProperties(singleLSProp);
                        while (singleStmtIt.hasNext()) {
                            Statement singleLSStmt =
                                    singleStmtIt.nextStatement();
                            Resource singleLSRes =
                                    singleLSStmt.getResource();

                            Individual singleLSInst =
                                    _OntModel.getIndividual(singleLSRes.getURI());

                            StmtIterator itLang =
                                    singleLSInst.listProperties(inLanguageProp);
                            StmtIterator itChar =
                                    singleLSInst.listProperties(hasValueProp);

                            while (itLang.hasNext()) {
                                Statement stmtLang =
                                        itLang.nextStatement();
                                String languageS =
                                        stmtLang.getString();
                                if ((languageS.compareTo(language) == 0) ||
                                        (language.compareTo("") == 0)) {
                                    Statement stmtChar =
                                            itChar.nextStatement();
                                    String charS =
                                            stmtChar.getString();
                                    result.add(charS);
                                }
                            }
                        }
                    }
                }
            }
        }

        return result;
    }

    /**
     * This operation returns a learning object classification keyword
     * from a specific classification instance
     * If a language instance is specified, the output contains only the
     * element in the given language.
     * <p>
     * @param loId the Learning Object identifier.
     * @param language the filter to retrieve the values of a specific language.
     * @param classificationId the classification identifier instance
     * @return a Set of String that contains the classification
     * keyword of the learning object according to the language.
     */
    public Set<String> getLOMClassificationKeyword(String loId, String language,
            String classificationId) {

        Set<String> result =
                new LinkedHashSet<String>();
        /*
         * Check if a instance about the LOReference exists,
         * and then search the description.
         */
        //Get lom ontology model             
        for (int i =
                0; i < _onts.size(); i++) {
            Ontology ont =
                    _onts.get(i);


            String ns =
                    ont.getNameSpace() + ont.getLocalName();
            if (ns.compareTo(_nsName) == 0) {
                _OntModel =
                        ont.getOntModel();
                break;
            }
        }

        Resource clasRes =
                _OntModel.getResource(classificationId);


        ObjectProperty claKey =
                _OntModel.getObjectProperty(_nsName + "#classificationKeyword");
        StmtIterator lsInstances =
                clasRes.listProperties(claKey);



        Property singleLSProp =
                _OntModel.getProperty(_nsName +
                "#includesSingleLangString");
        Property hasValueProp =
                _OntModel.getProperty(_nsName + "#hasValue");
        Property inLanguageProp =
                _OntModel.getProperty(_nsName +
                "#inLanguage");


        if (!lsInstances.hasNext()) {
            result.clear();
            return result;
        } else {
            if (language.compareTo("") == 0) {
                while (lsInstances.hasNext()) {
                    Statement descrStmt =
                            lsInstances.nextStatement();
                    Resource lsRes =
                            descrStmt.getResource();
                    StmtIterator singleStmtIt =
                            lsRes.listProperties(singleLSProp);
                    while (singleStmtIt.hasNext()) {
                        Statement singleLSStmt =
                                singleStmtIt.nextStatement();
                        Resource singleLSRes =
                                singleLSStmt.getResource();

                        Individual singleLSInst =
                                _OntModel.getIndividual(singleLSRes.getURI());

                        StmtIterator itChar =
                                singleLSInst.listProperties(hasValueProp);

                        while (itChar.hasNext()) {
                            Statement stmtChar =
                                    itChar.nextStatement();
                            String charS =
                                    stmtChar.getString();
                            result.add(charS);
                        }
                    }

                }
            } else {
                while (lsInstances.hasNext()) {
                    Statement titleStmt =
                            lsInstances.nextStatement();
                    Resource lsRes =
                            titleStmt.getResource();
                    StmtIterator singleStmtIt =
                            lsRes.listProperties(singleLSProp);
                    while (singleStmtIt.hasNext()) {
                        Statement singleLSStmt =
                                singleStmtIt.nextStatement();
                        Resource singleLSRes =
                                singleLSStmt.getResource();

                        Individual singleLSInst =
                                _OntModel.getIndividual(singleLSRes.getURI());

                        StmtIterator itLang =
                                singleLSInst.listProperties(inLanguageProp);
                        StmtIterator itChar =
                                singleLSInst.listProperties(hasValueProp);

                        while (itLang.hasNext()) {
                            Statement stmtLang =
                                    itLang.nextStatement();
                            String languageS =
                                    stmtLang.getString();
                            if ((languageS.compareTo(language) == 0) ||
                                    (language.compareTo("") == 0)) {
                                Statement stmtChar =
                                        itChar.nextStatement();
                                String charS =
                                        stmtChar.getString();
                                result.add(charS);
                            }
                        }
                    }
                }
            }
        }

        return result;
    }
}



